blacklight_advanced_search 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a0d1a3ae8894d6913705748f4f0c36cd946aed0
4
- data.tar.gz: 490f7bd162c8016890aafb194d6f2219fd4275ed
3
+ metadata.gz: f94e150438b2ed6a6fabd89cfbd050babfbcd96e
4
+ data.tar.gz: ad24822b9631e506de17d7a11db709dba64a68e7
5
5
  SHA512:
6
- metadata.gz: 37e8e598f7d4f513085ba671ceed8f9ad3fe273235fcb05c690dfd9912af8848af63e4a68d5e60ae6d709e9c2156240bca9e1d6d567259d55a8e581ce1c3aa48
7
- data.tar.gz: 7be40cbe6fcbcf8b5c14220f4f7ddaedc94c519576938c8766862e2c3d6890ea445d9b6a3c5ae5df37823edf84067bd54af7951d22367a1257a4539733e9d646
6
+ metadata.gz: 72a0b4d1718c5f03c69df999c11bc2465d787c0198932e7f964c06bb20097c9db6950107ea9c14eb65f6c4a77bbe0ba3a4c06f29cafa2680c24eb65761650a29
7
+ data.tar.gz: 3961675ce8655a762252fce99bede4bfd758c52e2a96ff33c69263ce722bbf27143599fc8bc3a27052c0b6393daacc379fce12712310afc97317bdf235e4ae2c
data/.rubocop.yml CHANGED
@@ -13,3 +13,9 @@ Rails:
13
13
 
14
14
  Metrics/LineLength:
15
15
  Max: 185
16
+
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - 'Rakefile'
20
+ - 'spec/**/*'
21
+ - 'lib/generators/**/*'
data/.rubocop_todo.yml CHANGED
@@ -349,3 +349,9 @@ Style/TrailingUnderscoreVariable:
349
349
  Style/VariableName:
350
350
  Exclude:
351
351
  - 'lib/parsing_nesting/tree.rb'
352
+
353
+ Style/RedundantReturn:
354
+ Enabled: false
355
+
356
+ Style/GuardClause:
357
+ Enabled: false
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.1.0
1
+ 6.2.0
@@ -28,4 +28,5 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency 'engine_cart', "~> 0.10"
29
29
  s.add_development_dependency 'rubocop'
30
30
  s.add_development_dependency 'rubocop-rspec'
31
+ s.add_development_dependency 'rsolr'
31
32
  end
@@ -48,8 +48,8 @@ module BlacklightAdvancedSearch
48
48
  # parse and send it straight to solr same as if advanced_parse_q
49
49
  # were not being used.
50
50
  def add_advanced_parse_q_to_solr(solr_parameters)
51
- unless scope.params[:q].blank?
52
- field_def = search_field_def_for_key(scope.params[:search_field]) ||
51
+ unless blacklight_params[:q].blank?
52
+ field_def = search_field_def_for_key(blacklight_params[:search_field]) ||
53
53
  default_search_field
54
54
 
55
55
  # If the individual field has advanced_parse_q suppressed, punt
@@ -61,7 +61,7 @@ module BlacklightAdvancedSearch
61
61
  # See if we can parse it, if we can't, we're going to give up
62
62
  # and just allow basic search, perhaps with a warning.
63
63
  begin
64
- adv_search_params = ParsingNesting::Tree.parse(scope.params[:q], blacklight_config.advanced_search[:query_parser]).to_single_query_params(solr_local_params)
64
+ adv_search_params = ParsingNesting::Tree.parse(blacklight_params[:q], blacklight_config.advanced_search[:query_parser]).to_single_query_params(solr_local_params)
65
65
 
66
66
  BlacklightAdvancedSearch.deep_merge!(solr_parameters, solr_direct_params)
67
67
  BlacklightAdvancedSearch.deep_merge!(solr_parameters, adv_search_params)
@@ -47,20 +47,19 @@ module BlacklightAdvancedSearch
47
47
  end
48
48
 
49
49
  def install_localized_search_form
50
- if options[:force] || yes?("Install local search form with advanced link? (y/N)", :green)
51
- # We're going to copy the search from from actual currently loaded
52
- # Blacklight into local app as custom local override -- but add our link at the end too.
53
- source_file = File.read(File.join(Blacklight.root, "app/views/catalog/_search_form.html.erb"))
50
+ return unless options[:force] || yes?("Install local search form with advanced link? (y/N)", :green)
51
+ # We're going to copy the search from from actual currently loaded
52
+ # Blacklight into local app as custom local override -- but add our link at the end too.
53
+ source_file = File.read(File.join(Blacklight.root, "app/views/catalog/_search_form.html.erb"))
54
54
 
55
- new_file_contents = source_file + <<-EOF.strip_heredoc
56
- \n\n
57
- <div class="navbar-form">
58
- <%= link_to 'More options', blacklight_advanced_search_engine.advanced_search_path(search_state.to_h), class: 'advanced_search btn btn-default'%>
59
- </div>
60
- EOF
55
+ new_file_contents = source_file + <<-EOF.strip_heredoc
56
+ \n\n
57
+ <div class="navbar-form">
58
+ <%= link_to 'More options', blacklight_advanced_search_engine.advanced_search_path(search_state.to_h), class: 'advanced_search btn btn-default'%>
59
+ </div>
60
+ EOF
61
61
 
62
- create_file("app/views/catalog/_search_form.html.erb", new_file_contents)
63
- end
62
+ create_file("app/views/catalog/_search_form.html.erb", new_file_contents)
64
63
  end
65
64
  end
66
65
  end
@@ -10,24 +10,24 @@ describe BlacklightAdvancedSearch::AdvancedSearchBuilder do
10
10
  end
11
11
  end
12
12
 
13
- let!(:obj) do
13
+ let(:obj) do
14
14
  class BACTestClass
15
- cattr_accessor :blacklight_config
15
+ cattr_accessor :blacklight_config, :blacklight_params
16
16
  include Blacklight::SearchHelper
17
17
  include BlacklightAdvancedSearch::AdvancedSearchBuilder
18
- def initialize(blacklight_config)
18
+ def initialize(blacklight_config, blacklight_params)
19
19
  self.blacklight_config = blacklight_config
20
+ self.blacklight_params = blacklight_params
20
21
  end
21
22
  end
22
- BACTestClass.new blacklight_config
23
+ BACTestClass.new blacklight_config, params
23
24
  end
24
25
 
25
26
  context "with basic functionality" do
26
27
  let(:solr_params) { {} }
27
28
 
28
29
  describe "a simple example" do
29
- let(:params) { double("params", params: { :q => "one two AND three OR four" }) }
30
- before { allow(obj).to receive(:scope).and_return(params) }
30
+ let(:params) { { :q => "one two AND three OR four" } }
31
31
  it "catches the query" do
32
32
  obj.add_advanced_parse_q_to_solr(solr_params)
33
33
  expect(solr_params[:defType]).to eq("lucene")
@@ -39,8 +39,7 @@ describe BlacklightAdvancedSearch::AdvancedSearchBuilder do
39
39
 
40
40
  describe "an unparseable example" do
41
41
  let(:unparseable_q) { "foo bar\'s AND" }
42
- let(:params) { double("params", params: { :q => unparseable_q }) }
43
- before { allow(obj).to receive(:scope).and_return(params) }
42
+ let(:params) { { :q => unparseable_q } }
44
43
  it "passes through" do
45
44
  obj.add_advanced_parse_q_to_solr(solr_params)
46
45
  expect(solr_params[:q]).to eq(unparseable_q)
@@ -48,8 +47,7 @@ describe BlacklightAdvancedSearch::AdvancedSearchBuilder do
48
47
  end
49
48
 
50
49
  context "when advanced_parse is false" do
51
- let(:params) { double("params", params: { :search_field => "special_field", :q => "one two AND three OR four" }) }
52
- before { allow(obj).to receive(:scope).and_return(params) }
50
+ let(:params) { { :search_field => "special_field", :q => "one two AND three OR four" } }
53
51
  it "ignores fields" do
54
52
  obj.add_advanced_parse_q_to_solr(solr_params)
55
53
  expect(solr_params).not_to have_key(:q)
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] = "test"
3
3
  require 'engine_cart'
4
4
  EngineCart.load_application!
5
5
 
6
+ require 'rsolr'
6
7
  require 'capybara/rspec'
7
8
  require 'rspec/rails'
8
9
  require 'capybara/rails'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_advanced_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-28 00:00:00.000000000 Z
12
+ date: 2016-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -143,6 +143,20 @@ dependencies:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
+ - !ruby/object:Gem::Dependency
147
+ name: rsolr
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
146
160
  description:
147
161
  email:
148
162
  - blacklight-development@googlegroups.com
@@ -252,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
266
  version: '0'
253
267
  requirements: []
254
268
  rubyforge_project: blacklight
255
- rubygems_version: 2.5.1
269
+ rubygems_version: 2.5.2
256
270
  signing_key:
257
271
  specification_version: 4
258
272
  summary: Blacklight Advanced Search plugin