Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/controllers/concerns/spotlight/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
module Spotlight
# ...
module SearchHelper
# @param [Hash] user_params the query parameters used to reconstitute the search state
# from saved searches. If not provided, will use the search_state from the view context
# or an empty hash if that is not available.
# @return [Object] An instance of the configured search service
def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
state = Blacklight::SearchState.new(user_params, blacklight_config)
klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService

klass.new(config: blacklight_config, user_params:, **search_service_context)
klass.new(config: blacklight_config, search_state: state, **search_service_context)
end

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