blacklight 7.37.0 → 7.38.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
  SHA256:
3
- metadata.gz: a363d5e420f14ec8b9bc11825cfa98fd31e0be3b7e45da9fb1a60895d8d7e491
4
- data.tar.gz: 928f51bf66d44b4dbb2243e845f978176a78720e50f386340c1f247c542fc7f2
3
+ metadata.gz: 92827fbcd7473cda5ed226586db52428b4f24b1298c50d1d67ef408ccfd94baa
4
+ data.tar.gz: 37513bedbec7cd84dc92e87cae3686f6e3c3e87f7e56bc13e07e34e84714410b
5
5
  SHA512:
6
- metadata.gz: ec45d9d2d4e513eecc80ed7de3c47d083bb0b0a43f52863f1cdf28504be9688d0568a61ba1ab739da100a85b503b9f185346ea7fdd8519d35d9a736023e5a879
7
- data.tar.gz: d73ec607a44211851883e93a49d40a2eebb31f55e4967a9347866b891499f8ea49444cd2faa1352124e8482a38abc84ad0891485e2c4dfd6cb4a685ea726b30a
6
+ metadata.gz: 560541c83c6adfa1f0aa9c3f9bc5a12ba4415d3a152393ae422da91f46b138dee10335d195c2edd2d9e9f7905885dbce6deed95b8bdad4728e861e04f5186ce7
7
+ data.tar.gz: '039d446972e1c7270bb487bc9ee0a19ff44a553b9c5cd5bac1947ec1e819406104ebded74edfd6cf9522fa2920334f972353c1e9be6e584257ed67420b59cb76'
@@ -131,6 +131,26 @@ jobs:
131
131
  run: bundle exec rake ci
132
132
  env:
133
133
  ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-keeps --skip-action-cable --skip-test'
134
+ test_rails7_2:
135
+ runs-on: ubuntu-latest
136
+ strategy:
137
+ matrix:
138
+ ruby: [3.1, 3.2]
139
+ env:
140
+ RAILS_VERSION: 7.2.0
141
+ steps:
142
+ - uses: actions/checkout@v2
143
+ - name: Set up Ruby
144
+ uses: ruby/setup-ruby@v1
145
+ with:
146
+ ruby-version: ${{ matrix.ruby }}
147
+ bundler: 'default'
148
+ - name: Install dependencies
149
+ run: bundle install
150
+ - name: Run tests
151
+ run: bundle exec rake ci
152
+ env:
153
+ ENGINE_CART_RAILS_OPTIONS: '--skip-keeps --skip-test'
134
154
  test_vc3:
135
155
  runs-on: ubuntu-latest
136
156
  strategy:
@@ -176,6 +196,6 @@ jobs:
176
196
  docker_build:
177
197
  runs-on: ubuntu-latest
178
198
  steps:
179
- - uses: actions/checkout@v2
180
- - name: Build docker image
181
- run: docker-compose build app
199
+ - uses: actions/checkout@v3
200
+ - name: Build docker image
201
+ run: docker compose build app
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.37.0
1
+ 7.38.0
@@ -73,12 +73,13 @@ module Blacklight::UrlHelperBehavior
73
73
 
74
74
  ##
75
75
  # Attributes for a link that gives a URL we can use to track clicks for the current search session
76
+ # We disable turbo prefetch (InstantClick), because since we replace the link with a form, it's just wasted.
76
77
  # @private
77
78
  # @param [SolrDocument] document
78
79
  # @param [Integer] counter
79
80
  # @example
80
81
  # session_tracking_params(SolrDocument.new(id: 123), 7)
81
- # => { data: { :'context-href' => '/catalog/123/track?counter=7&search_id=999' } }
82
+ # => { data: { context_href: '/catalog/123/track?counter=7&search_id=999' } }
82
83
  def session_tracking_params document, counter
83
84
  path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document&.id)
84
85
 
@@ -86,7 +87,7 @@ module Blacklight::UrlHelperBehavior
86
87
  return {}
87
88
  end
88
89
 
89
- { data: { 'context-href': path } }
90
+ { data: { context_href: path, turbo_prefetch: false } }
90
91
  end
91
92
  private :session_tracking_params
92
93
 
@@ -146,7 +146,15 @@ module Blacklight
146
146
  .merge(blacklight_config.fetch_many_document_params)
147
147
  .merge(extra_controller_params)
148
148
 
149
- solr_response = repository.search(query)
149
+ # find_many was introduced in Blacklight 8.4. Before that, we used the
150
+ # regular search method (possibly with a find-many specific `qt` parameter).
151
+ # In order to support Repository implementations that may not have a find_many,
152
+ # we'll fall back to search if find_many isn't available.
153
+ solr_response = if repository.respond_to?(:find_many)
154
+ repository.find_many(query)
155
+ else
156
+ repository.search(query)
157
+ end
150
158
 
151
159
  [solr_response, solr_response.documents]
152
160
  end
data/blacklight.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  s.required_ruby_version = '>= 2.5'
27
27
 
28
- s.add_dependency "rails", '>= 5.1', '< 7.2'
28
+ s.add_dependency "rails", '>= 5.1', '< 7.3'
29
29
  s.add_dependency "globalid"
30
30
  s.add_dependency "jbuilder", '~> 2.7'
31
31
  s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
data/docker-compose.yml CHANGED
@@ -9,7 +9,7 @@ services:
9
9
  - ALPINE_RUBY_VERSION
10
10
  # mounting . is causing seg-fault on macosx
11
11
  #volumes:
12
- #- .:/app
12
+ #- .:/app
13
13
  depends_on:
14
14
  - solr
15
15
  ports:
@@ -34,6 +34,12 @@ module Blacklight
34
34
  raise NotImplementedError
35
35
  end
36
36
 
37
+ # Find multiple documents by their ids
38
+ # @param [Hash] _params query parameters
39
+ def find_many(params, **kwargs)
40
+ search(params, **kwargs)
41
+ end
42
+
37
43
  ##
38
44
  # Execute a search query against a search index
39
45
  # @param [Hash] _params query parameters
@@ -89,6 +89,10 @@ module Blacklight
89
89
  # @!attribute default_document_solr_params
90
90
  # @return [Hash] Default values of parameters to send with every single-document request
91
91
  property :default_document_solr_params, default: {}
92
+ # @!attribute fetch_many_documents_path
93
+ # @since v8.4.0
94
+ # @return [String] The url path (relative to the solr base url) to use when requesting multiple documents by id
95
+ property :fetch_many_documents_path, default: nil
92
96
  # @!attribute fetch_many_document_params
93
97
  # @since v7.0.0
94
98
  # @return [Hash] Default values of parameters to send with every multi-document request
@@ -16,11 +16,20 @@ module Blacklight::Solr
16
16
  solr_response
17
17
  end
18
18
 
19
+ # Find multiple documents by their ids
20
+ # @param [Hash] _params query parameters
21
+ def find_many(params)
22
+ search(params: params, path: blacklight_config.fetch_many_documents_path)
23
+ end
24
+
19
25
  ##
20
26
  # Execute a search query against solr
21
27
  # @param [Hash] params solr query parameters
22
- def search params = {}
23
- send_and_receive search_path(params), params.reverse_merge(qt: blacklight_config.qt)
28
+ # @param [String] path solr request handler path
29
+ def search pos_params = {}, path: nil, params: nil, **kwargs
30
+ request_params = (params || pos_params).reverse_merge(kwargs).reverse_merge({ qt: blacklight_config.qt })
31
+
32
+ send_and_receive(path || default_search_path(request_params), request_params)
24
33
  end
25
34
 
26
35
  # @param [Hash] request_params
@@ -123,7 +132,7 @@ module Blacklight::Solr
123
132
  end
124
133
 
125
134
  # @return [String]
126
- def search_path(solr_params)
135
+ def default_search_path(solr_params)
127
136
  return blacklight_config.json_solr_path if blacklight_config.json_solr_path && uses_json_query_dsl?(solr_params)
128
137
 
129
138
  blacklight_config.solr_path
@@ -73,6 +73,24 @@ RSpec.describe Blacklight::Solr::Repository, api: true do
73
73
  end
74
74
  end
75
75
 
76
+ describe '#find_many' do
77
+ context 'with a configured fetch_many_documents_path' do
78
+ it 'uses the path' do
79
+ blacklight_config.fetch_many_documents_path = 'documents'
80
+ allow(subject.connection).to receive(:send_and_receive).with('documents', anything).and_return(mock_response)
81
+ expect(subject.find_many({})).to be_a Blacklight::Solr::Response
82
+ end
83
+ end
84
+
85
+ context 'without a configured fetch_many_documents_path' do
86
+ it 'falls back to the search path' do
87
+ blacklight_config.solr_path = 'xyz'
88
+ allow(subject.connection).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
89
+ expect(subject.find_many({})).to be_a Blacklight::Solr::Response
90
+ end
91
+ end
92
+ end
93
+
76
94
  describe "#search" do
77
95
  it "uses the search-specific solr path" do
78
96
  blacklight_config.solr_path = 'xyz'
@@ -21,18 +21,18 @@ def system_with_error_handling(*args)
21
21
  end
22
22
 
23
23
  def with_solr
24
- # We're being invoked by the app entrypoint script and solr is already up via docker-compose
24
+ # We're being invoked by the app entrypoint script and solr is already up via docker compose
25
25
  if ENV['SOLR_ENV'] == 'docker-compose'
26
26
  yield
27
- elsif system('docker-compose -v')
28
- # We're not running docker-compose up but still want to use a docker instance of solr.
27
+ elsif system('docker compose -v')
28
+ # We're not running `docker compose up' but still want to use a docker instance of solr.
29
29
  begin
30
30
  puts "Starting Solr"
31
- system_with_error_handling "docker-compose up -d solr"
31
+ system_with_error_handling "docker compose up -d solr"
32
32
  yield
33
33
  ensure
34
34
  puts "Stopping Solr"
35
- system_with_error_handling "docker-compose stop solr"
35
+ system_with_error_handling "docker compose stop solr"
36
36
  end
37
37
  else
38
38
  SolrWrapper.wrap do |solr|
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: 7.37.0
4
+ version: 7.38.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: 2024-02-22 00:00:00.000000000 Z
20
+ date: 2024-08-13 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -28,7 +28,7 @@ dependencies:
28
28
  version: '5.1'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '7.2'
31
+ version: '7.3'
32
32
  type: :runtime
33
33
  prerelease: false
34
34
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  version: '5.1'
39
39
  - - "<"
40
40
  - !ruby/object:Gem::Version
41
- version: '7.2'
41
+ version: '7.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: globalid
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -957,7 +957,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
957
957
  - !ruby/object:Gem::Version
958
958
  version: '0'
959
959
  requirements: []
960
- rubygems_version: 3.5.4
960
+ rubygems_version: 3.5.15
961
961
  signing_key:
962
962
  specification_version: 4
963
963
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)