blacklight-spotlight 0.28.0 → 0.28.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece8d22f7b1839d5ea4fb24642d7805f9ab02567
|
4
|
+
data.tar.gz: 604eeed993a923572cd6c7fb533f531ed395427d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5004e50bc5c190078217936076b7667d48089eb9e222ca8d4a7d9b7554059d49a02ebd18504afaae233d890b1b0fdc1a24e164547cab391aa309f6cd5ca973b3
|
7
|
+
data.tar.gz: dc8f7e5ccbfe784a6c3372c0131843bf2fe0732227fb279761ac7cc76532b5662d361ec7ef213c37cea3b2c1ff9824711941e9a127f55e2a807633ba4be6ad02
|
@@ -26,9 +26,7 @@ module Spotlight
|
|
26
26
|
protected
|
27
27
|
|
28
28
|
def search_query
|
29
|
-
|
30
|
-
user_query = Blacklight::SearchState.new(params, blacklight_config).to_h
|
31
|
-
base_query.params_for_search(user_query)
|
29
|
+
@search.merge_params_for_search(params, blacklight_config)
|
32
30
|
end
|
33
31
|
|
34
32
|
##
|
@@ -21,8 +21,8 @@ module Spotlight
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def get_search_widget_search_results(block)
|
24
|
-
if block.
|
25
|
-
search_results(
|
24
|
+
if block.search.present?
|
25
|
+
search_results(block.search.merge_params_for_search(params, blacklight_config))
|
26
26
|
else
|
27
27
|
[]
|
28
28
|
end
|
@@ -50,13 +50,5 @@ module Spotlight
|
|
50
50
|
def render_contact_email_address(address)
|
51
51
|
mail_to address, address
|
52
52
|
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def search_widget_search_query(block)
|
57
|
-
base_query = Blacklight::SearchState.new(block.query_params, blacklight_config)
|
58
|
-
user_query = Blacklight::SearchState.new(params, blacklight_config).to_h
|
59
|
-
base_query.params_for_search(user_query)
|
60
|
-
end
|
61
53
|
end
|
62
54
|
end
|
@@ -78,6 +78,12 @@ module Spotlight
|
|
78
78
|
search_builder.with(query_params.with_indifferent_access).merge(facet: false, fl: default_search_fields)
|
79
79
|
end
|
80
80
|
|
81
|
+
def merge_params_for_search(params, blacklight_config)
|
82
|
+
base_query = Blacklight::SearchState.new(query_params, blacklight_config)
|
83
|
+
user_query = Blacklight::SearchState.new(params, blacklight_config).to_h
|
84
|
+
base_query.params_for_search(user_query).merge(user_query.slice(:page))
|
85
|
+
end
|
86
|
+
|
81
87
|
private
|
82
88
|
|
83
89
|
def search_builder_class
|
data/lib/spotlight/version.rb
CHANGED
@@ -118,4 +118,20 @@ describe Spotlight::Search, type: :model do
|
|
118
118
|
expect(search.send(:repository).blacklight_config).to eql blacklight_config
|
119
119
|
end
|
120
120
|
end
|
121
|
+
|
122
|
+
describe '#merge_params_for_search' do
|
123
|
+
it 'merges user-supplied parameters into the search query' do
|
124
|
+
user_params = { view: 'x' }
|
125
|
+
search_params = subject.merge_params_for_search(user_params, blacklight_config)
|
126
|
+
expect(search_params).to include query_params
|
127
|
+
expect(search_params).to include user_params
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'preserves user pagination' do
|
131
|
+
user_params = { page: 5, per_page: 7 }
|
132
|
+
search_params = subject.merge_params_for_search(user_params, blacklight_config)
|
133
|
+
expect(search_params).to include query_params
|
134
|
+
expect(search_params).to include user_params
|
135
|
+
end
|
136
|
+
end
|
121
137
|
end
|