-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configured search_state_class propagates to search builder #2719
Conversation
@@ -27,7 +27,8 @@ def initialize(*options) | |||
end | |||
|
|||
@blacklight_params = {} | |||
@search_state = Blacklight::SearchState.new(@blacklight_params, @scope&.blacklight_config, @scope) | |||
search_state_class = @scope&.search_state_class || Blacklight::SearchState | |||
@search_state = search_state_class.new(@blacklight_params, @scope&.blacklight_config, @scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be cleaner if we gave Blacklight::SearchService
a default_search_state
/empty_search_state
/etc method?
In 8.x, it looks like we could update with
and where
to require an existing SearchState
instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a better forward-looking approach; here I'm mostly trying to conform to the existing API (although SearchService and Blacklight::Controller drift a little bit here). I'm totally willing to pivot to empty_search_state
early, though, if you're 👍 on adding some API in 7.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to move both search_state_class
and search_service_class
onto Blacklight::Configuration
, and have the controller and search service both delegate there. (the builder class config is already there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a commit here that:
- consolidates the class configurations into a dedicated config
- adds a search state factory method to
Blacklight::Searchable
andBlacklight::SearchService
- removes the direct access to configured search state classes in favor of
SearchState#reset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain a bit more about the need for the repository_config? Should that go on a branch that is merged to main
prior to a backport to 7.x
? Can we separate that into another PR and provide justification for it?
Sure: Right now there are two classes of object that function in the "scope" role for a This presents a problem if the application has implemented a In the first commit in this PR, I simply exposed a In the second commit of this PR, I tried to suggest a way to do that - but if we were to make the I think we could also drop the second commit and just immediately deprecate the |
@barmintor Hyrax uses the |
@jcoyne let me stash the second commit somewhere else |
ea2002e
to
7f28620
Compare
@jcoyne ok I've reverted that change - thank you for the Hyrax note. This now just adds |
Is there a need to forward port this? |
@jcoyne there is - I'll put a PR together. |
Forward port in #2722 |
see also #2716
SearchBuilder always uses the default SearchState implementation, regardless of application configuration. This PR allows the SearchBuilder scope to indicate the class to use for search states.