blacklight 6.17.0 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: ab78d68e30d49fcc8d4f8308d4340080a7697f604cc5face23c75fcdae3fea27
4
- data.tar.gz: f9f0457f2d22cb0fdeba22fac2a89f7b88a525591052cf8d3fc7a965c9555d59
2
+ SHA1:
3
+ metadata.gz: 59d179acd38459b0540692e705b2c4835f31c022
4
+ data.tar.gz: e3f02fe1b03842e4d80fe678435105064504c8c6
5
5
  SHA512:
6
- metadata.gz: a73b55d12488b47cfe7a5d511512806e2c03e157015697598ffb9c2bb9fe3a526b5cac56624089802ff7895381251ed8ae39e011a7076b47a713a3e3480ac803
7
- data.tar.gz: 520745be6bb8458dc8fc050343f90f941b43d80f5c4e013bdc0f5d11f20009f4416fa92576c23a46f00a889f92737b2bee694ddda0137a37fe0bb741db6c88d8
6
+ metadata.gz: f55802166972b36f29a5e687c4e42a323426b27a189134bc7940bf227e0532e6b183c57b4f3d539f92dd64a85ca8c915af68bd627e50c6560b9c07061a6141ad
7
+ data.tar.gz: dec4137377509c2eebd25f4c63fb7302d9daf7e22d84e8bc7b0a8916999637c7d048b51964c7de8b7e8ebd5dcddb7739c7453c5304a612b9e045be9c9b3bc02d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.17.0
1
+ 6.18.0
@@ -141,8 +141,9 @@ module Blacklight::SearchHelper
141
141
  query = search_builder.
142
142
  with(user_params).
143
143
  where(blacklight_config.document_model.unique_key => ids).
144
- merge(extra_controller_params).
145
- merge(fl: '*')
144
+ merge(blacklight_config.fetch_many_document_params || deprecated_fetch_many_document_params).
145
+ merge(extra_controller_params)
146
+
146
147
  solr_response = repository.search(query)
147
148
 
148
149
  [solr_response, solr_response.documents]
@@ -152,4 +153,9 @@ module Blacklight::SearchHelper
152
153
  solr_response = repository.find id, extra_controller_params
153
154
  [solr_response, solr_response.documents.first]
154
155
  end
156
+
157
+ def deprecated_fetch_many_document_params
158
+ Deprecation.warn(self, 'You should configure blacklight_config.fetch_many_document_params; defaulting to { fl: "*" }, but this will be removed in Blacklight 7')
159
+ { fl: '*' }
160
+ end
155
161
  end
@@ -57,6 +57,7 @@ module Blacklight
57
57
  #rows: 1
58
58
  },
59
59
  document_pagination_params: {},
60
+ fetch_many_document_params: nil,
60
61
  ##
61
62
  # == Response models
62
63
  ## Class for sending and receiving requests from a search index
@@ -16,13 +16,13 @@ describe Blacklight::SearchHelper do
16
16
  class SearchHelperTestClass
17
17
  include Blacklight::SearchHelper
18
18
 
19
- attr_accessor :blacklight_config
20
- attr_accessor :repository
19
+ attr_accessor :blacklight_config, :repository, :search_state
21
20
 
22
- def initialize blacklight_config, conn
21
+ def initialize blacklight_config, conn, state
23
22
  self.blacklight_config = blacklight_config
24
23
  self.repository = Blacklight::Solr::Repository.new(blacklight_config)
25
24
  self.repository.connection = conn
25
+ self.search_state = search_state
26
26
  end
27
27
 
28
28
  def params
@@ -30,11 +30,12 @@ describe Blacklight::SearchHelper do
30
30
  end
31
31
  end
32
32
 
33
- subject { SearchHelperTestClass.new blacklight_config, blacklight_solr }
33
+ subject { SearchHelperTestClass.new blacklight_config, blacklight_solr, state }
34
34
 
35
35
  let(:blacklight_config) { Blacklight::Configuration.new }
36
36
  let(:copy_of_catalog_config) { ::CatalogController.blacklight_config.deep_copy }
37
37
  let(:blacklight_solr) { RSolr.connect(Blacklight.connection_config.except(:adapter)) }
38
+ let(:state) { {} }
38
39
 
39
40
  before(:each) do
40
41
  @all_docs_query = ''
@@ -307,6 +308,24 @@ describe Blacklight::SearchHelper do
307
308
  end
308
309
  end
309
310
 
311
+ describe 'Get multiple documents By Id', integration: true do
312
+ let(:doc_id) { '2007020969' }
313
+ let(:bad_id) { 'redrum' }
314
+ let(:response) { subject.fetch([doc_id]).first }
315
+
316
+ before do
317
+ blacklight_config.fetch_many_document_params = { fl: 'id,format' }
318
+ end
319
+
320
+ it 'has the expected value in the id field' do
321
+ expect(response.documents.first.id).to eq doc_id
322
+ end
323
+
324
+ it 'returns all the requested fields' do
325
+ expect(response.documents.first['format']).to eq 'Book'
326
+ end
327
+ end
328
+
310
329
  # SPECS FOR SPELLING SUGGESTIONS VIA SEARCH
311
330
  describe "Searches should return spelling suggestions", :integration => true do
312
331
  it 'search results for just-poor-enough-query term should have (multiple) spelling suggestions' do
@@ -377,7 +396,7 @@ describe Blacklight::SearchHelper do
377
396
  it "returns nil if no @response available" do
378
397
  expect(subject.facet_limit_for("some_unknown_field")).to be_nil
379
398
  end
380
- it "gets from @response facet.limit if available" do
399
+ it "gets from @response facet.limit if available" do
381
400
  @response = instance_double(Blacklight::Solr::Response, aggregations: { "language_facet" => double(limit: nil) })
382
401
  subject.instance_variable_set(:@response, @response)
383
402
  blacklight_config.facet_fields['language_facet'].limit = 10
@@ -392,7 +411,7 @@ describe Blacklight::SearchHelper do
392
411
  expect(subject.facet_limit_for("language_facet")).to eq 10
393
412
  end
394
413
  end
395
-
414
+
396
415
  context 'for facet fields with a key that is different from the field name' do
397
416
  let(:blacklight_config) do
398
417
  Blacklight::Configuration.new do |config|
@@ -424,11 +443,11 @@ describe Blacklight::SearchHelper do
424
443
  it "pulls the grouped key out of the config" do
425
444
  blacklight_config.index.group = 'xyz'
426
445
  expect(subject.grouped_key_for_results).to eq('xyz')
427
- end
446
+ end
428
447
  end
429
448
 
430
449
  describe "#get_previous_and_next_documents_for_search" do
431
- let(:pre_query) { SearchHelperTestClass.new blacklight_config, blacklight_solr }
450
+ let(:pre_query) { SearchHelperTestClass.new blacklight_config, blacklight_solr, state }
432
451
  before do
433
452
  @full_response, @all_docs = pre_query.search_results(q: '', per_page: '100')
434
453
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.17.0
4
+ version: 6.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2018-11-06 00:00:00.000000000 Z
20
+ date: 2018-11-08 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -765,7 +765,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
765
765
  version: '0'
766
766
  requirements: []
767
767
  rubyforge_project:
768
- rubygems_version: 2.7.6
768
+ rubygems_version: 2.6.11
769
769
  signing_key:
770
770
  specification_version: 4
771
771
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)