Fix: Sanitize dash or plus from the text search path (#12789)

This commit is contained in:
Trenton H authored and GitHub committed 2026-05-12 12:41:38 -07:00
1 parent 5f42854d99
commit 7e381f204e
2 files changed
+49 -1

No files matched your search

+5 -1
View File
@@ -618,7 +618,11 @@ def parse_simple_text_highlight_query(
SnippetGenerator we build a plain term query over the content field instead.
"""
tokens = _simple_query_tokens(raw_query)
# Strip Tantivy operator chars before tokenizing: this is a plain-text
# highlight query, not a structured boolean query, so +/- are separators.
tokens = _simple_query_tokens(
regex.sub(r"[-+]", " ", raw_query, timeout=_REGEX_TIMEOUT),
)
if not tokens:
return tantivy.Query.empty_query()