From 2a7a96d772e8a3b12845a99717b51b1c93bb27bb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 24 Oct 2024 17:38:37 +0800 Subject: [PATCH] :art: Return document blocks when search hits different block content https://github.com/siyuan-note/siyuan/issues/10584 --- kernel/model/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/search.go b/kernel/model/search.go index fbd64ffe7..77ba2c45f 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))