WeKnora/internal/searchutil
MercuialC c7601b2d2a
feat(wiki): 增加跨知识库 Wiki 搜索 POST /wiki-search (#3535)
* feat(wiki): add cross-KB wiki search POST /wiki-search

Give external callers a knowledge-search counterpart for wiki pages: one
SQL IN query ranked by title/slug/summary/content, slim hits with
match_snippet, and Viewer retrieve auth including shared KBs.

* fix(wiki): satisfy golangci-lint on cross-KB wiki search

Check c.Error returns, wrap lines over 120 columns, and use wikiDialect
instead of the embedded Dialector selector.

* fix(wiki): address review on cross-KB search helpers

Share KB viewer auth and snippet extraction, keep ID limits in the
service layer, and escape SQLite LIKE wildcards.

* fix(lint): wrap knowledge span fixtures over 120 columns

Go Lint still diffs from the original PR base, so later main tests
in knowledge_spans_test.go were reported as new line-length issues.

* fix(wiki): authorize KB access before checking wiki enablement in cross-KB search

Checking IsWikiEnabled before AuthorizeKBAccess let a caller tell apart a
foreign KB with wiki disabled (400) from one it cannot see (404), leaking
the KB's existence and settings. Run the access check first.

---------

Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:22:58 +08:00
..
chunkmerge.go fix(chunk-merge): stop dropping content when contiguous chunks repeat text 2026-08-13 19:58:57 +08:00
chunkmerge_test.go fix(chunk-merge): stop dropping content when contiguous chunks repeat text 2026-08-13 19:58:57 +08:00
conversion.go feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00
imageinfo.go feat(chat): open cited documents at the cited passage (#3700) 2026-09-25 13:26:16 +08:00
imageinfo_disabled_test.go fix(retrieval): 分段中删除的图片不再被检索到 2026-08-20 12:01:28 +08:00
imageinfo_html_test.go fix(docparser): resolve remote images referenced by HTML img tags (#2355) 2026-07-28 21:08:31 +08:00
imageinfo_match.go fix(docparser): resolve remote images referenced by HTML img tags (#2355) 2026-07-28 21:08:31 +08:00
imageinfo_match_test.go fix(chat): keep OCR/caption text of scanned-page image hits in merge (#3064) 2026-09-07 11:38:47 +08:00
imageinfo_pages_test.go feat(chat): open cited documents at the cited passage (#3700) 2026-09-25 13:26:16 +08:00
normalize.go refactor: Introduce searchutil package for web search result conversion and keyword score normalization 2025-12-01 18:27:12 +08:00
snippet.go feat(wiki): 增加跨知识库 Wiki 搜索 POST /wiki-search (#3535) 2026-09-25 22:22:58 +08:00
snippet_test.go feat(wiki): 增加跨知识库 Wiki 搜索 POST /wiki-search (#3535) 2026-09-25 22:22:58 +08:00
textutil.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00