Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Return document blocks when search hits different block content https://github.com/siyuan-note/siyuan/issues/10584

Daniel2a7a96d772e8
diff --git a/kernel/model/search.go b/kernel/model/search.go
index fbd64ffe7b..77ba2c45fa 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -1407,7 +1407,7 @@ func fullTextSearchByFTSWithRoot(query, boxFilter, pathFilter, typeFilter, ignor
wheheClause := " WHERE id IN (SELECT id FROM nonDocBlocks) OR id IN (SELECT root_id FROM docBlocks)"
selectStmt := cteStmt + "\nSELECT * FROM " + table + wheheClause
countStmt := cteStmt + "\nSELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM " + table + wheheClause
- cteStmt += orderBy + " LIMIT " + strconv.Itoa(pageSize) + " OFFSET " + strconv.Itoa((page-1)*pageSize)
+ selectStmt += orderBy + " LIMIT " + strconv.Itoa(pageSize) + " OFFSET " + strconv.Itoa((page-1)*pageSize)
resultBlocks := sql.SelectBlocksRawStmtNoParse(selectStmt, -1)
logging.LogInfof("time cost [main search]: %v", time.Since(start))