Pass search_state object to SearchService instead of params hash#3591
Pass search_state object to SearchService instead of params hash#3591
Conversation
| # ... | ||
| module SearchHelper | ||
| def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {}) | ||
| search_state = Blacklight::SearchState.new(user_params, blacklight_config) |
There was a problem hiding this comment.
Can't you just grab the search_state from the view context? Why do you have to initialize it yourself?
There was a problem hiding this comment.
Spotlight stores saved searches in the database for use in search and browse widgets and this method gets used to reconstitute those searches from hashes.
There was a problem hiding this comment.
Can we make a Search#search_state method just for that class and not have the conditionals in this method?
There was a problem hiding this comment.
That change alone isn't enough. Spotlight is relying on the behavior in that search_service method elsewhere. And it's tangled up with how search state is being managed to be aware of the current exhibit scope. More work should be done to clean this up, but it's beyond the scope of what I can do right now.
a59e532 to
e0f6d6f
Compare
e0f6d6f to
f1358ff
Compare
Fixes #3590