semantic search 固定回 topK=20、無分數閾值——低分尾摻入不相關結果硬湊數 #67
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
現象(claude.ai 2026-07-19 實測 leo21c):任何 semantic 查詢固定 count=20,前 2-5 筆相關、之後低分尾全是無關內容(老 Logseq 遺產混入更放大觀感)。
根因(源碼核實):
kbdb/src/embed.ts:240topK: Math.min(opts.topK ?? 20, 100),回傳 matches 全量 hydrate,零 score 閾值、零截斷;route 也未曝 topK/min_score 參數。修法建議:①
min_score閾值(可配置,預設保守)+回應帶 score 讓 caller 自裁 ②topK 可調 ③長期=D30 檢索策略治本(嵌入粒度收斂卡級摘要;#58 殘影/#59 模型/#60 alias 家族——本 issue 是該家族的「截斷」缺口,rag_chat v2 頁級聚合只是繞開)。出處:
rag-wave1/normalize-and-retrieval-strategy.md;雲端總管代開。修復 PR 已開:#70(#70)。route 曝
top_k(預設 20、封頂 100)/min_score(預設 0=不過濾),semanticSearch 依閾值截低分尾,semantic 回應 entry 附score欄(加欄不改形,caller 可自裁)。不帶新參數行為不變(向後相容)。kbdb vitest 33/33 綠、tsc 0。與 #66 同 PR;D30 檢索策略治本(嵌入粒度/#58/#59/#60 家族)不在本 PR 範圍。merge 後需 gated redeploy kbdb worker(leo 閘)。✅ live 驗證過關單(leo21c
ff6be30b):mode=semantic&top_k=5&min_score=0.5回 5 筆全 ≥0.5 分數降冪(首名 0.875=正確命中 KPI 卡);不帶參數維持 20 筆+entry 附 score 欄=向後相容。治本(D30 嵌入粒度)另走 library-map M6+#58/#59/#60。