Skip to content

Commit e0f6d6f

Browse files
committed
Pass search_state object to SearchService instead of params hash
1 parent 459d721 commit e0f6d6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/controllers/concerns/spotlight/search_helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
module Spotlight
44
# ...
55
module SearchHelper
6+
# @param [Hash] user_params the query parameters if not using search_state from
7+
# the view context. Used to reconstitute the search state from saved searches.
8+
# @return [Object] An instance of the configured search service
69
def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
10+
search_state = Blacklight::SearchState.new(user_params, blacklight_config)
711
klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService
812

9-
klass.new(config: blacklight_config, user_params:, **search_service_context)
13+
klass.new(config: blacklight_config, search_state:, **search_service_context)
1014
end
1115

1216
# @return [Hash] a hash of context information to pass through to the search service

0 commit comments

Comments
 (0)