Skip to content

Commit f1358ff

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/controllers/concerns/spotlight/search_helper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
module Spotlight
44
# ...
55
module SearchHelper
6+
# @param [Hash] user_params the query parameters used to reconstitute the search state
7+
# from saved searches. If not provided, will use the search_state from the view context
8+
# or an empty hash if that is not available.
9+
# @return [Object] An instance of the configured search service
610
def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
11+
state = Blacklight::SearchState.new(user_params, blacklight_config)
712
klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService
813

9-
klass.new(config: blacklight_config, user_params:, **search_service_context)
14+
klass.new(config: blacklight_config, search_state: state, **search_service_context)
1015
end
1116

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

0 commit comments

Comments
 (0)