blacklight 8.8.1 → 8.8.3
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 +4 -4
- data/VERSION +1 -1
- data/app/components/blacklight/document/action_component.rb +1 -3
- data/app/components/blacklight/facet_field_component.html.erb +1 -1
- data/app/models/blacklight/facet_paginator.rb +1 -1
- data/app/presenters/blacklight/json_presenter.rb +1 -3
- data/lib/blacklight/search_state/filter_field.rb +2 -2
- data/package.json +1 -1
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/facets_spec.rb +18 -0
- data/spec/lib/blacklight/parameters_spec.rb +12 -1
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +18 -0
- data/spec/services/blacklight/search_service_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1e08ce0753e7c685ea8c89ddb71a79df93264b09316f4fd42d10e9df6b0445a
|
4
|
+
data.tar.gz: f2fd78857733c1d5729806da77d823b459aa66414d753b27e03ae3b9bc2adac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8109311a031925baef9b67a4a89a5c0acd49d7ed7822e5d129b7c22b9920e742684035685bd780f293de3a6f78b4725dc22fbd77d77f8513d54cfe467d9c06
|
7
|
+
data.tar.gz: b245a145acf722e3e505820fafa9d1731fbbd30d43e2bca4465ffa9e430bfffe542fe81761b1c6d92cdcca84d561d2026a75d293c19ecd57ea479f3aba3ede56
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.8.
|
1
|
+
8.8.3
|
@@ -16,7 +16,7 @@ module Blacklight
|
|
16
16
|
# and need to make them accessible in a list so we can easily
|
17
17
|
# strip em out before redirecting to catalog/index.
|
18
18
|
mattr_accessor :request_keys do
|
19
|
-
{ sort: :'facet.sort', page: :'facet.page', prefix: :'facet.prefix' }
|
19
|
+
{ sort: :'facet.sort', page: :'facet.page', prefix: :'facet.prefix', fragment: :query_fragment, only: :only_values }
|
20
20
|
end
|
21
21
|
|
22
22
|
attr_reader :offset, :limit, :sort, :prefix
|
@@ -13,9 +13,7 @@ module Blacklight
|
|
13
13
|
|
14
14
|
delegate :facet_field_names, :facet_configuration_for_field, to: :blacklight_config
|
15
15
|
|
16
|
-
|
17
|
-
@response.documents
|
18
|
-
end
|
16
|
+
delegate :documents, to: :@response
|
19
17
|
|
20
18
|
# @return [Array<Blacklight::Solr::Response::Facets::FacetField>]
|
21
19
|
def search_facets
|
@@ -145,8 +145,8 @@ module Blacklight
|
|
145
145
|
def permitted_params
|
146
146
|
if config.pivot
|
147
147
|
{
|
148
|
-
filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => [], "-#{key}" => []) },
|
149
|
-
inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => []) }
|
148
|
+
filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => [], "-#{key}" => []) },
|
149
|
+
inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => []) }
|
150
150
|
}
|
151
151
|
else
|
152
152
|
{
|
data/package.json
CHANGED
@@ -803,7 +803,7 @@ RSpec.describe CatalogController, :api do
|
|
803
803
|
end
|
804
804
|
|
805
805
|
it "is empty for empty result sets", :integration do
|
806
|
-
get :page_links, params: { f: { "format" => 'empty-result-set' }, counter: 1 }
|
806
|
+
get :page_links, params: { f: { "format" => ['empty-result-set'] }, counter: 1 }
|
807
807
|
expect(assigns(:page_link_data)).to be_empty
|
808
808
|
end
|
809
809
|
end
|
@@ -125,6 +125,24 @@ RSpec.describe "Facets" do
|
|
125
125
|
expect(page).to have_link 'Tibetan language'
|
126
126
|
expect(page).to have_css 'a.facet-select', count: 1
|
127
127
|
end
|
128
|
+
|
129
|
+
it 'allows the user to filter more than once', :js do
|
130
|
+
visit '/catalog/facet/subject_ssim'
|
131
|
+
expect(page).to have_no_link 'Old age' # This is on the second page of facet values
|
132
|
+
expect(page).to have_css 'a.facet-select', count: 20
|
133
|
+
|
134
|
+
fill_in 'facet_suggest_subject_ssim', with: "ag"
|
135
|
+
|
136
|
+
expect(page).to have_link 'Old age'
|
137
|
+
expect(page).to have_link('Old age', href: '/?f%5Bsubject_ssim%5D%5B%5D=Old+age')
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe 'facebook-style facet parameters' do
|
143
|
+
it 'can perform a search' do
|
144
|
+
visit '/?f[subject_ssim][0]=Iran.+Viza%CC%84rat-i+Kishvar'
|
145
|
+
expect(page).to have_text 'Naqdī barā-yi tamām-i fuṣūl'
|
128
146
|
end
|
129
147
|
end
|
130
148
|
end
|
@@ -52,7 +52,7 @@ RSpec.describe Blacklight::Parameters do
|
|
52
52
|
let(:search_state) { Blacklight::SearchState.new(query_params, blacklight_config) }
|
53
53
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
54
54
|
|
55
|
-
context 'with
|
55
|
+
context 'with facebook\'s badly mangled query parameters' do
|
56
56
|
let(:query_params) do
|
57
57
|
ActionController::Parameters.new(
|
58
58
|
f: { field: { '0': 'first', '1': 'second' } },
|
@@ -67,6 +67,17 @@ RSpec.describe Blacklight::Parameters do
|
|
67
67
|
it 'normalizes the facets to the expected format' do
|
68
68
|
expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
|
69
69
|
end
|
70
|
+
|
71
|
+
context 'when several fields are configured' do
|
72
|
+
before do
|
73
|
+
blacklight_config.add_facet_field 'other_field'
|
74
|
+
blacklight_config.add_facet_field 'some_other_pivot_field', pivot: %w[abc def]
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'normalizes the facets to the expected format' do
|
78
|
+
expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
|
79
|
+
end
|
80
|
+
end
|
70
81
|
end
|
71
82
|
|
72
83
|
context 'with filter_search_state_fields set to false' do
|
@@ -198,4 +198,22 @@ RSpec.describe Blacklight::SearchState::FilterField do
|
|
198
198
|
expect(search_state.filter('some_field').include?(OpenStruct.new(value: '1'))).to be true
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
describe '#permitted_params' do
|
203
|
+
context 'with a pivot facet' do
|
204
|
+
let(:blacklight_config) do
|
205
|
+
Blacklight::Configuration.new.configure do |config|
|
206
|
+
config.add_facet_field 'my_pivot', pivot: %w[format language_ssim]
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'marks all the pivot fields as permitted' do
|
211
|
+
field = described_class.new blacklight_config.facet_fields['my_pivot'], search_state
|
212
|
+
expect(field.permitted_params).to eq({
|
213
|
+
f: { "-format" => [], "-language_ssim" => [], "format" => [], "language_ssim" => [] },
|
214
|
+
f_inclusive: { "format" => [], "language_ssim" => [] }
|
215
|
+
})
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
201
219
|
end
|
@@ -59,7 +59,7 @@ RSpec.describe Blacklight::SearchService, :api do
|
|
59
59
|
allow(blacklight_config).to receive(:default_solr_params).and_return(qt: 'custom_request_handler')
|
60
60
|
allow(blacklight_solr).to receive(:send_and_receive) do |path, params|
|
61
61
|
expect(path).to eq 'select'
|
62
|
-
expect(params[:params]['facet.field']).to
|
62
|
+
expect(params[:params]['facet.field']).to contain_exactly "format", "{!ex=pub_date_ssim_single}pub_date_ssim", "subject_ssim", "language_ssim", "lc_1letter_ssim", "subject_geo_ssim", "subject_era_ssim"
|
63
63
|
expect(params[:params]["facet.query"]).to eq ["pub_date_ssim:[#{5.years.ago.year} TO *]", "pub_date_ssim:[#{10.years.ago.year} TO *]", "pub_date_ssim:[#{25.years.ago.year} TO *]"]
|
64
64
|
expect(params[:params]).to include('rows' => 10, 'qt' => "custom_request_handler", 'q' => "", "f.subject_ssim.facet.limit" => 21, 'sort' => "score desc, pub_date_si desc, title_si asc")
|
65
65
|
end.and_return('response' => { 'docs' => [] })
|
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: 8.8.
|
4
|
+
version: 8.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
- Justin Coyne
|
17
17
|
bindir: exe
|
18
18
|
cert_chain: []
|
19
|
-
date: 2025-02-
|
19
|
+
date: 2025-02-26 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rails
|