Root-cause fix for "search returns garbage for absent terms". The hybrid RPC's dense branch always returned its k nearest vectors regardless of distance, so a query for a term not in the corpus (e.g. "varginha") surfaced unrelated chunks. The cross-encoder reranker would filter these but costs 18-62s on CPU — unusable for interactive search. Add max_dense_dist (default 0.40) to hybrid_search_chunks: dense neighbours beyond that cosine distance are dropped server-side. Calibrated from measured distances — strong semantic match ~0.12-0.20, no real match ~0.46-0.53. BM25 full-text still matches literal terms; the reranker becomes opt-in refinement. Verified live: varginha/abducao → 0, disco voador/roswell → relevant, all <1s. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| db.ts | ||
| embed.ts | ||
| entity-pages.ts | ||
| graph.ts | ||
| hybrid.ts | ||