Add parentheses to advanced search queries #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this Pull Request do?
Adds Parentheses to search queries around each specific search field (everything but "all").
This solves an issue where multi field advanced searches don't return anything if any of the fields (except the final field) are not searching "all". This doesn't seem to be an issue in the sandbox, but it causes issues on my customized site. Adding parentheses shouldn't change the behaviour of sites that are working, but should fix the ones that aren't.
Slack conversation: https://islandora.slack.com/archives/C019U12D44Q/p1726583682481869
What's new?
The only change is that each field searched with be wrapped in parentheses.
Previously, searching
would create this query
q=+tm_X3b_en_title:acadia+tm_X3b_und_title:acadia+AND+acadia
But with this PR it looks like this
q=(+tm_X3b_en_title:acadia+tm_X3b_und_title:acadia)+AND+acadia
How should this be tested?
Try a multi-field search and check the Solr log to see the query without parentheses. Perform the same search with this PR to see the parentheses added to the query. The results of the search should be the same with the PR, or should fix the issue mentioned above.
Documentation Status
No documentation changes necessary
Additional Notes:
N/A
Interested parties
@aOelschlager
@Islandora/committers