kbdb /entries/search keyword 路徑 source 參數解析後丟棄(#5.1 只做了一半) #66

Closed
opened 2026-07-19 06:30:43 +00:00 by Leo · 2 comments
Owner

現象(claude.ai 2026-07-19 實測)GET /entries/search?q=...&source=gitea:Leo/kb@.../xxx.md 不帶 mode(=keyword)時,回傳 45 筆完全不受 source 限制。

根因(源碼核實,main)kbdb/src/routes/entries.ts:67 有解析 source,但 keyword 分支 :94 呼叫 searchEntries(DB, q, owner_id, entry_type, undefined, library)——searchEntriesactions/entry-crud.ts函式簽名沒有 source 參數,解析完即丟。semantic 分支有傳(Vectorize metadata filter 正常);GET /entries 列表也有接(#5.1 那半)。唯獨 search keyword 漏。

修法:searchEntries 加 source?: string,conds 補 json_extract(metadata_json,'$.source') = ?(與 listEntries #5.1 同款謂詞),route :94 傳入。

出處:頂層 wiki status 2026-07-19 段;雲端總管代開。

**現象(claude.ai 2026-07-19 實測)**:`GET /entries/search?q=...&source=gitea:Leo/kb@.../xxx.md` 不帶 mode(=keyword)時,回傳 45 筆完全不受 source 限制。 **根因(源碼核實,main)**:`kbdb/src/routes/entries.ts:67` 有解析 `source`,但 keyword 分支 `:94` 呼叫 `searchEntries(DB, q, owner_id, entry_type, undefined, library)`——`searchEntries`(`actions/entry-crud.ts`)**函式簽名沒有 source 參數**,解析完即丟。semantic 分支有傳(Vectorize metadata filter 正常);`GET /entries` 列表也有接(#5.1 那半)。唯獨 search keyword 漏。 **修法**:searchEntries 加 `source?: string`,conds 補 `json_extract(metadata_json,'$.source') = ?`(與 listEntries #5.1 同款謂詞),route :94 傳入。 出處:頂層 wiki status 2026-07-19 段;雲端總管代開。
Author
Owner

修復 PR 已開:#70(#70)。searchEntries 尾端加 source?+與 listEntries #5.1 同款 json_extract 謂詞,route keyword 分支與 semantic 降級分支兩處傳入。kbdb vitest 33/33 綠、tsc 0。與 #67 同 PR。merge 後需 gated redeploy kbdb worker(leo 閘)。

修復 PR 已開:#70(https://git.uncle6.me/Leo/Arcrun/pulls/70)。`searchEntries` 尾端加 `source?`+與 listEntries #5.1 同款 json_extract 謂詞,route keyword 分支與 semantic 降級分支兩處傳入。kbdb vitest 33/33 綠、tsc 0。與 #67 同 PR。merge 後需 gated redeploy kbdb worker(leo 閘)。
Author
Owner

live 驗證過關單(leo21c ff6be30b,雲端總管 2026-07-19 實測):/entries/search?q=KPI&source=<不存在值> 回 0 筆、不帶 source 同 q 回 45 筆=謂詞已接上。

✅ live 驗證過關單(leo21c `ff6be30b`,雲端總管 2026-07-19 實測):`/entries/search?q=KPI&source=<不存在值>` 回 0 筆、不帶 source 同 q 回 45 筆=謂詞已接上。
Leo closed this issue 2026-07-19 08:27:30 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Leo/Arcrun#66