Skip to content

Commit

Permalink
Merge pull request #2753 from projectblacklight/backport-2752
Browse files Browse the repository at this point in the history
Pass a SearchState instance when building the advanced search form search service
  • Loading branch information
corylown authored Jun 29, 2022
2 parents a1ffe64 + 2651929 commit 56b161e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/controllers/concerns/blacklight/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def show
end

def advanced_search
empty_service = search_service_class.new(config: blacklight_config, user_params: {}, **search_service_context)

(@response, _deprecated_document_list) = empty_service.search_results
(@response, _deprecated_document_list) = blacklight_advanced_search_form_search_service.search_results
end

# get a single document from the index
Expand Down Expand Up @@ -334,4 +332,14 @@ def handle_request_error(exception)
flash[:notice] = flash_notice
redirect_to search_action_url
end

def blacklight_advanced_search_form_search_service
form_search_state = search_state_class.new(blacklight_advanced_search_form_params, blacklight_config, self)

search_service_class.new(config: blacklight_config, search_state: form_search_state, user_params: form_search_state.to_h, **search_service_context)
end

def blacklight_advanced_search_form_params
{}
end
end

0 comments on commit 56b161e

Please sign in to comment.