fix(ai): /ask retrieval OR + stopword drop (follow-up to #636, LC-676) #637
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/LC-676-ask-retrieval-followup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to LC-676 / PR #636.
Why a second PR
PR #636 was merged at its first commit (
09426e6), before the retrieval-fix commit (434c0b8) reached the branch - so main got the loading state, prompt, rendering, slash-hint, and composer fixes, but NOT the actual retrieval fix. That retrieval fix is the one that resolves the reported symptom (a room full of "David" still answering "who is david?" with "Could not find information about David"). This PR cherry-picks it onto current main.The fix
build_contextran the question throughsanitize_fts_query, which space-joins terms = FTS5 implicit AND, so "who is david?" required a single message containing "who" AND "is" AND "david" - none exists - and retrieval returned nothing, so the model correctly said "no context".New
db::chat::fts_query_any(used only by the /ask RAG path): trims punctuation, drops common question stopwords, and joins the remaining content words with OR, so "who is david?" ->"david"and matches. The search box keeps its precise AND semantics.Tests
db_search: a unit test pins the OR + stopword behavior, and an integration test asserts the old AND query retrieves nothing whilefts_query_anyretrieves exactly the David context. Fulldb_search(18), fmt green.🤖 Generated with Claude Code
https://claude.ai/code/session_013pGppokMfgq5W46EY2Takg