fix(holographic): robust FTS5 retrieval for operator characters and partial-match queries - #44040
Conversation
…nd partial-match queries FTS5 MATCH raises syntax errors on natural queries containing '/' or '-' (e.g. "90/180", "gpt-5.5"), and the implicit AND semantics return zero rows for multi-word queries unless every token matches. Both cases made fact_store search silently return no results. Two-stage fallback in _fts_candidates: 1. On FTS5 syntax error, retry with each token quoted as a phrase. 2. On zero rows from AND semantics, retry with OR over quoted tokens. Measured on a 2133-fact store: recall pass rate 8/14 -> 14/14 (MRR 1.0) on a keyword eval suite, no regression on latency (4-61 ms).
|
Verification: Reviewed the diff — improves FTS5 resilience for queries containing operators/punctuation. The retry logic is well-structured:
The sanitization One edge case to consider: if the original query is a single token like LGTM — the three-tier fallback (AND raw → AND quoted → OR quoted) covers the common failure modes without over-matching. |
|
Thanks for the focused FTS5 resilience work. This is already implemented on current
This also aligns with the duplicate relationship noted in the discussion. |
FTS5 MATCH raises syntax errors on natural-language queries containing operator characters such as
/or-(e.g.90/180,gpt-5.5), and implicit AND semantics return zero rows for multi-word queries unless every token matches. In both casesfact_storesearch silently returns no results, which reads as memory loss to the agent.This adds a two-stage fallback in
FactRetriever._fts_candidates:Measured on a live 2,133-fact store: keyword recall eval went 8/14 to 14/14 (MRR 1.0), latency unchanged (4-61 ms per query). Both fallbacks only run when the primary query path fails or returns nothing, so well-formed queries are untouched.
Related: filed #44037 for a separate fd-recycle corruption issue observed on the same provider.