[ticket/17614] Remove invalid syntax from sphinx search queries#6987
Open
ECYaz wants to merge 1 commit into
Open
[ticket/17614] Remove invalid syntax from sphinx search queries#6987ECYaz wants to merge 1 commit into
ECYaz wants to merge 1 commit into
Conversation
|
The attempt to merge branch
A separate PR will be needed to merge |
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. PHPBB-17614
4 tasks
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
A search containing an unmatched parenthesis or quotation mark, for example
search.php?keywords=test+%29, makes searchd reject the whole query with a syntax error. The user gets a general error and a criticalLOG_SPHINX_ERRORentry is logged. Empty groups like()and operators without an operand fail the same way.This cleans the query at the end of
sphinx_clean_search_string(): unmatched quotation marks and parentheses, empty groups and operators without an operand are removed. Valid syntax such as(either | or), nested groups and phrases is preserved. If nothing searchable remains after cleaning, the search returns no results instead of sending an empty query that would match every post.