fix(ck-engine): parse lexical queries leniently instead of erroring on tantivy syntax (#166)
ck is grep-shaped, so lexical (--lex) queries arrive as arbitrary strings — from shell one-liners, scripts, and AI agents — that were never meant to be tantivy query syntax. QueryParser::parse_query rejects the whole search when the input contains anything it can't fully interpret: an unbalanced quote, a stray `field:` colon, a bare AND/OR, a leading wildcard. The terms that could still match are discarded along with the syntax error, and callers are forced to sanitize queries before handing them over. Switch lexical_search to QueryParser::parse_query_lenient: the interpretable terms are kept and the un-parseable fragments are dropped, with the parser's errors logged at debug level rather than propagated. A query that already parses cleanly yields the same query object, so its results and scores are unchanged (covered by an invariance test comparing strict and lenient parses); a query where every fragment errors degrades to normal empty results instead of a hard failure.
A
Adam committed
df46105daeff312aa019fba20e253303d4c363c8
Parent: 4023f99
Committed by GitHub <noreply@github.com>
on 7/7/2026, 8:26:57 PM