blacklight 7.36.2 → 7.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +26 -6
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +35 -31
- data/app/components/blacklight/facet_field_component.html.erb +2 -1
- data/app/helpers/blacklight/url_helper_behavior.rb +3 -2
- data/app/javascript/blacklight/checkbox_submit.js +1 -0
- data/app/javascript/blacklight/core.js +3 -0
- data/app/javascript/blacklight/search_context.js +1 -3
- data/app/services/blacklight/search_service.rb +9 -1
- data/app/values/blacklight/types.rb +14 -0
- data/blacklight.gemspec +1 -1
- data/docker-compose.yml +1 -1
- data/lib/blacklight/abstract_repository.rb +6 -0
- data/lib/blacklight/configuration.rb +4 -0
- data/lib/blacklight/solr/repository.rb +12 -3
- data/package.json +1 -1
- data/spec/models/blacklight/solr/repository_spec.rb +18 -0
- data/spec/models/solr_document_spec.rb +6 -2
- data/tasks/blacklight.rake +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92827fbcd7473cda5ed226586db52428b4f24b1298c50d1d67ef408ccfd94baa
|
4
|
+
data.tar.gz: 37513bedbec7cd84dc92e87cae3686f6e3c3e87f7e56bc13e07e34e84714410b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560541c83c6adfa1f0aa9c3f9bc5a12ba4415d3a152393ae422da91f46b138dee10335d195c2edd2d9e9f7905885dbce6deed95b8bdad4728e861e04f5186ce7
|
7
|
+
data.tar.gz: '039d446972e1c7270bb487bc9ee0a19ff44a553b9c5cd5bac1947ec1e819406104ebded74edfd6cf9522fa2920334f972353c1e9be6e584257ed67420b59cb76'
|
data/.github/workflows/ruby.yml
CHANGED
@@ -47,7 +47,7 @@ jobs:
|
|
47
47
|
- name: Run tests
|
48
48
|
run: bundle exec rake ci
|
49
49
|
env:
|
50
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-
|
50
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
51
51
|
test_bootstrap5:
|
52
52
|
runs-on: ubuntu-latest
|
53
53
|
strategy:
|
@@ -68,7 +68,7 @@ jobs:
|
|
68
68
|
run: bundle exec rake ci
|
69
69
|
env:
|
70
70
|
BOOTSTRAP_VERSION: '~> 5.0'
|
71
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-
|
71
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
72
72
|
test_rails6_0:
|
73
73
|
runs-on: ubuntu-latest
|
74
74
|
strategy:
|
@@ -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:
|
@@ -151,7 +171,7 @@ jobs:
|
|
151
171
|
- name: Run tests
|
152
172
|
run: bundle exec rake ci
|
153
173
|
env:
|
154
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-
|
174
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
155
175
|
api_test:
|
156
176
|
runs-on: ubuntu-latest
|
157
177
|
strategy:
|
@@ -176,6 +196,6 @@ jobs:
|
|
176
196
|
docker_build:
|
177
197
|
runs-on: ubuntu-latest
|
178
198
|
steps:
|
179
|
-
|
180
|
-
|
181
|
-
|
199
|
+
- uses: actions/checkout@v3
|
200
|
+
- name: Build docker image
|
201
|
+
run: docker compose build app
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.38.0
|
@@ -1,17 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
|
3
|
+
const Blacklight = function () {
|
4
4
|
var buffer = new Array();
|
5
5
|
return {
|
6
|
-
onLoad: function
|
6
|
+
onLoad: function (func) {
|
7
7
|
buffer.push(func);
|
8
8
|
},
|
9
|
-
activate: function
|
9
|
+
activate: function () {
|
10
10
|
for (var i = 0; i < buffer.length; i++) {
|
11
11
|
buffer[i].call();
|
12
12
|
}
|
13
13
|
},
|
14
|
-
listeners: function
|
14
|
+
listeners: function () {
|
15
15
|
var listeners = [];
|
16
16
|
if (typeof Turbo !== 'undefined') {
|
17
17
|
listeners.push('turbo:load');
|
@@ -39,7 +39,7 @@ Blacklight.listeners().forEach(function (listener) {
|
|
39
39
|
});
|
40
40
|
});
|
41
41
|
Blacklight.onLoad(function () {
|
42
|
-
|
42
|
+
const elem = document.querySelector('.no-js');
|
43
43
|
|
44
44
|
// The "no-js" class may already have been removed because this function is
|
45
45
|
// run on every turbo:load event, in that case, it won't find an element.
|
@@ -47,6 +47,14 @@ Blacklight.onLoad(function () {
|
|
47
47
|
elem.classList.remove('no-js');
|
48
48
|
elem.classList.add('js');
|
49
49
|
});
|
50
|
+
Blacklight.csrfToken = () => {
|
51
|
+
var _document$querySelect;
|
52
|
+
return (_document$querySelect = document.querySelector('meta[name=csrf-token]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
|
53
|
+
};
|
54
|
+
Blacklight.csrfParam = () => {
|
55
|
+
var _document$querySelect2;
|
56
|
+
return (_document$querySelect2 = document.querySelector('meta[name=csrf-param]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content;
|
57
|
+
};
|
50
58
|
window.Blacklight = Blacklight;
|
51
59
|
/*global Bloodhound */
|
52
60
|
|
@@ -89,7 +97,7 @@ Blacklight.onLoad(function () {
|
|
89
97
|
$(Blacklight.doBookmarkToggleBehavior.selector).blCheckboxSubmit({
|
90
98
|
// cssClass is added to elements added, plus used for id base
|
91
99
|
cssClass: 'toggle-bookmark',
|
92
|
-
success: function
|
100
|
+
success: function (checked, response) {
|
93
101
|
if (response.bookmarks) {
|
94
102
|
$('[data-role=bookmark-counter]').text(response.bookmarks.count);
|
95
103
|
}
|
@@ -105,8 +113,8 @@ Blacklight.onLoad(function () {
|
|
105
113
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
106
114
|
// Safari both do not set focus to a button on button click.
|
107
115
|
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
108
|
-
document.querySelectorAll('button.collapse-toggle').forEach(
|
109
|
-
button.addEventListener('click',
|
116
|
+
document.querySelectorAll('button.collapse-toggle').forEach(button => {
|
117
|
+
button.addEventListener('click', () => {
|
110
118
|
event.target.focus();
|
111
119
|
});
|
112
120
|
});
|
@@ -187,15 +195,18 @@ Blacklight.onLoad(function () {
|
|
187
195
|
checkbox.attr('disabled', 'disabled');
|
188
196
|
$.ajax({
|
189
197
|
url: form.attr('action'),
|
198
|
+
beforeSend: function (xhr) {
|
199
|
+
xhr.setRequestHeader('X-CSRF-Token', Blacklight.csrfToken());
|
200
|
+
},
|
190
201
|
dataType: 'json',
|
191
202
|
type: form.attr('method').toUpperCase(),
|
192
203
|
data: form.serialize(),
|
193
|
-
error: function
|
204
|
+
error: function () {
|
194
205
|
label.removeAttr('disabled');
|
195
206
|
checkbox.removeAttr('disabled');
|
196
207
|
options.error.call();
|
197
208
|
},
|
198
|
-
success: function
|
209
|
+
success: function (data, status, xhr) {
|
199
210
|
//if app isn't running at all, xhr annoyingly
|
200
211
|
//reports success with status 0.
|
201
212
|
if (xhr.status != 0) {
|
@@ -219,10 +230,10 @@ Blacklight.onLoad(function () {
|
|
219
230
|
$.fn.blCheckboxSubmit.defaults = {
|
220
231
|
//cssClass is added to elements added, plus used for id base
|
221
232
|
cssClass: 'blCheckboxSubmit',
|
222
|
-
error: function
|
233
|
+
error: function () {
|
223
234
|
alert("Error");
|
224
235
|
},
|
225
|
-
success: function
|
236
|
+
success: function () {} //callback
|
226
237
|
};
|
227
238
|
})(jQuery);
|
228
239
|
/*global Blacklight */
|
@@ -234,11 +245,11 @@ Blacklight.doResizeFacetLabelsAndCounts = function () {
|
|
234
245
|
return b.textContent.length - a.textContent.length;
|
235
246
|
}
|
236
247
|
document.querySelectorAll('.facet-values, .pivot-facet').forEach(function (elem) {
|
237
|
-
|
248
|
+
const nodes = elem.querySelectorAll('.facet-count');
|
238
249
|
// TODO: when we drop ie11 support, this can become the spread operator:
|
239
|
-
|
250
|
+
const longest = Array.from(nodes).sort(longer)[0];
|
240
251
|
if (longest && longest.textContent) {
|
241
|
-
|
252
|
+
const width = longest.textContent.length + 1 + 'ch';
|
242
253
|
elem.querySelector('.facet-count').style.width = width;
|
243
254
|
}
|
244
255
|
});
|
@@ -443,23 +454,15 @@ Blacklight.doSearchContextBehavior = function () {
|
|
443
454
|
console.warn("do_search_context_behavior is deprecated. Use doSearchContextBehavior instead.");
|
444
455
|
return Blacklight.do_search_context_behavior();
|
445
456
|
}
|
446
|
-
|
457
|
+
const elements = document.querySelectorAll('a[data-context-href]');
|
447
458
|
// Equivalent to Array.from(), but supports ie11
|
448
|
-
|
459
|
+
const nodes = Array.prototype.slice.call(elements);
|
449
460
|
nodes.forEach(function (element) {
|
450
461
|
element.addEventListener('click', function (e) {
|
451
462
|
Blacklight.handleSearchContextMethod.call(e.currentTarget, e);
|
452
463
|
});
|
453
464
|
});
|
454
465
|
};
|
455
|
-
Blacklight.csrfToken = function () {
|
456
|
-
var _document$querySelect;
|
457
|
-
return (_document$querySelect = document.querySelector('meta[name=csrf-token]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
|
458
|
-
};
|
459
|
-
Blacklight.csrfParam = function () {
|
460
|
-
var _document$querySelect2;
|
461
|
-
return (_document$querySelect2 = document.querySelector('meta[name=csrf-param]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content;
|
462
|
-
};
|
463
466
|
|
464
467
|
// this is the Rails.handleMethod with a couple adjustments, described inline:
|
465
468
|
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
@@ -471,17 +474,18 @@ Blacklight.handleSearchContextMethod = function (event) {
|
|
471
474
|
var link = this;
|
472
475
|
|
473
476
|
// instead of using the normal href, we need to use the context href instead
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
477
|
+
let href = link.getAttribute('data-context-href');
|
478
|
+
let target = link.getAttribute('target');
|
479
|
+
let csrfToken = Blacklight.csrfToken();
|
480
|
+
let csrfParam = Blacklight.csrfParam();
|
481
|
+
let form = document.createElement('form');
|
479
482
|
form.method = 'post';
|
480
483
|
form.action = href;
|
481
|
-
|
484
|
+
let formContent = "<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"".concat(link.getAttribute('href'), "\" type=\"hidden\" />");
|
482
485
|
|
483
486
|
// check for meta keys.. if set, we should open in a new tab
|
484
487
|
if (event.metaKey || event.ctrlKey) {
|
488
|
+
form.dataset.turbo = "false";
|
485
489
|
target = '_blank';
|
486
490
|
}
|
487
491
|
if (csrfParam !== undefined && csrfToken !== undefined) {
|
@@ -8,11 +8,12 @@
|
|
8
8
|
data-target="#<%= @facet_field.html_id %>"
|
9
9
|
data-bs-target="#<%= @facet_field.html_id %>"
|
10
10
|
aria-expanded="<%= @facet_field.collapsed? ? 'false' : 'true' %>"
|
11
|
+
arial-controls="<%= @facet_field.html_id %>"
|
11
12
|
>
|
12
13
|
<%= label %>
|
13
14
|
</button>
|
14
15
|
</h3>
|
15
|
-
<div id="<%= @facet_field.html_id %>" aria-labelledby="<%= @facet_field.html_id %>-header" class="panel-collapse facet-content collapse <%= "show" unless @facet_field.collapsed? %>">
|
16
|
+
<div id="<%= @facet_field.html_id %>" role="region" aria-labelledby="<%= @facet_field.html_id %>-header" class="panel-collapse facet-content collapse <%= "show" unless @facet_field.collapsed? %>">
|
16
17
|
<div class="card-body">
|
17
18
|
<%= body %>
|
18
19
|
|
@@ -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: { :
|
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: {
|
90
|
+
{ data: { context_href: path, turbo_prefetch: false } }
|
90
91
|
end
|
91
92
|
private :session_tracking_params
|
92
93
|
|
@@ -51,4 +51,7 @@ Blacklight.onLoad(function () {
|
|
51
51
|
elem.classList.add('js')
|
52
52
|
})
|
53
53
|
|
54
|
+
Blacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
|
55
|
+
Blacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
|
56
|
+
|
54
57
|
window.Blacklight = Blacklight
|
@@ -15,9 +15,6 @@ Blacklight.doSearchContextBehavior = function() {
|
|
15
15
|
})
|
16
16
|
};
|
17
17
|
|
18
|
-
Blacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
|
19
|
-
Blacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
|
20
|
-
|
21
18
|
// this is the Rails.handleMethod with a couple adjustments, described inline:
|
22
19
|
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
23
20
|
Blacklight.handleSearchContextMethod = function(event) {
|
@@ -42,6 +39,7 @@ Blacklight.handleSearchContextMethod = function(event) {
|
|
42
39
|
|
43
40
|
// check for meta keys.. if set, we should open in a new tab
|
44
41
|
if(event.metaKey || event.ctrlKey) {
|
42
|
+
form.dataset.turbo = "false";
|
45
43
|
target = '_blank';
|
46
44
|
}
|
47
45
|
|
@@ -146,7 +146,15 @@ module Blacklight
|
|
146
146
|
.merge(blacklight_config.fetch_many_document_params)
|
147
147
|
.merge(extra_controller_params)
|
148
148
|
|
149
|
-
|
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
|
@@ -69,6 +69,19 @@ module Blacklight
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
class Time < Value
|
73
|
+
def cast(input)
|
74
|
+
value = super
|
75
|
+
return if value.blank?
|
76
|
+
|
77
|
+
begin
|
78
|
+
::Time.parse(value.to_s) # rubocop:disable Rails/TimeZone
|
79
|
+
rescue ArgumentError
|
80
|
+
Rails.logger&.info "Unable to parse time: #{value.inspect}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
72
85
|
class Boolean < Value
|
73
86
|
def cast(input)
|
74
87
|
ActiveModel::Type::Boolean.new.cast(super)
|
@@ -110,6 +123,7 @@ module Blacklight
|
|
110
123
|
register :boolean, Boolean
|
111
124
|
register :string, String
|
112
125
|
register :date, Date
|
126
|
+
register :time, Time
|
113
127
|
register :array, Array
|
114
128
|
register :json, JsonValue
|
115
129
|
register :html, Html
|
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.
|
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
@@ -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
|
-
|
23
|
-
|
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
|
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
|
data/package.json
CHANGED
@@ -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'
|
@@ -49,6 +49,7 @@ RSpec.describe SolrDocument, api: true do
|
|
49
49
|
attribute :author, :array, 'author_tesim', of: :string
|
50
50
|
attribute :first_author, :select, 'author_tesim', by: :min
|
51
51
|
attribute :date, :date, field: 'date_dtsi'
|
52
|
+
attribute :time, :time, field: 'date_dtsi'
|
52
53
|
attribute :whatever, :string, default: ->(*) { 'default_value' }
|
53
54
|
end
|
54
55
|
end
|
@@ -56,14 +57,17 @@ RSpec.describe SolrDocument, api: true do
|
|
56
57
|
doc_class.new(id: '123',
|
57
58
|
title_tesim: ['Good Omens'],
|
58
59
|
author_tesim: ['Neil Gaiman', 'Terry Pratchett'],
|
59
|
-
date_dtsi: '1990-01-
|
60
|
+
date_dtsi: '1990-01-01T17:23:13Z')
|
60
61
|
end
|
61
62
|
|
62
63
|
it "casts the attributes" do
|
63
64
|
expect(document.title).to eq 'Good Omens'
|
64
65
|
expect(document.author).to eq ['Neil Gaiman', 'Terry Pratchett']
|
65
66
|
expect(document.first_author).to eq 'Neil Gaiman'
|
66
|
-
expect(document.date).to
|
67
|
+
expect(document.date).to be_a Date
|
68
|
+
expect(document.date.to_s).to eq '1990-01-01'
|
69
|
+
expect(document.time).to be_a Time
|
70
|
+
expect(document.time.to_s).to eq '1990-01-01 17:23:13 UTC'
|
67
71
|
expect(document.whatever).to eq 'default_value'
|
68
72
|
end
|
69
73
|
|
data/tasks/blacklight.rake
CHANGED
@@ -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
|
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
|
28
|
-
# We're not running docker
|
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
|
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
|
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.
|
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-
|
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.
|
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.
|
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.
|
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)
|