Skip to content
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

Add parentheses to advanced search queries #59

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

joshdentremont
Copy link
Contributor

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

image

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

@aOelschlager aOelschlager self-requested a review September 18, 2024 14:30
Copy link
Contributor

@aOelschlager aOelschlager left a comment

Choose a reason for hiding this comment

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

Tested this and it works. Thanks Josh!

@aOelschlager aOelschlager merged commit e05c783 into Islandora:2.x Jan 15, 2025
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.

2 participants