Skip to content

Conversation

@corylown
Copy link
Contributor

Fixes #3590

# ...
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just grab the search_state from the view context? Why do you have to initialize it yourself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make a Search#search_state method just for that class and not have the conditionals in this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@corylown corylown force-pushed the 3590-search-service-args branch from a59e532 to e0f6d6f Compare September 29, 2025 18:32
@corylown corylown force-pushed the 3590-search-service-args branch from e0f6d6f to f1358ff Compare September 29, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: Blacklight 9 SearchService no longer accepts user_params argument

2 participants