[ticket/17614] Remove invalid syntax from sphinx search queries#6989
Open
ECYaz wants to merge 1 commit into
Open
[ticket/17614] Remove invalid syntax from sphinx search queries#6989ECYaz wants to merge 1 commit into
ECYaz wants to merge 1 commit into
Conversation
Unmatched parentheses or quotation marks in the keywords, as well as parenthesized groups and operators left without any search term, made searchd fail the whole query with a syntax error which was logged and shown to the user as a general error. Clean the query in sphinx_clean_search_string() by removing unmatched quotation marks and parentheses (ignoring those within quotation marks), term-less groups and operators without an operand, while keeping valid grouping syntax like (either | or) intact. Skip querying altogether if no searchable term is left after cleaning, while keeping author-only searches working as they intentionally run with an empty query. PHPBB-17614
ECYaz
force-pushed
the
ticket/17614-master
branch
from
July 20, 2026 02:22
26c377f to
b98892c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist:
Tracker ticket:
https://tracker.phpbb.com/browse/PHPBB-17614
Master version of #6987, since the search backend moved in 4.x and the 3.3.x patch does not apply cleanly there. Same change: unmatched quotation marks and parentheses, empty groups and operators without an operand are removed from the query before it is sent to searchd, while valid syntax such as
(either | or)and phrases are preserved. Author searches, which intentionally run with an empty query, are unaffected.