Skip to content

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

:bug: 查找替换中使用正则表达式后替换不正确 https://github.com/siyuan-note/siyuan/issues/6722

Liang Ding425bb8c425f1
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 07f9cef0d0..3da69d6146 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -563,16 +563,16 @@ func fullTextSearchByRegexp(exp, box, path, typeFilter string, beforeLen int) (r
return
}
-func fullTextSearchCountByRegexp(exp, box, path, filter string) (matchedBlockCount, matchedRootCount int) {
+func fullTextSearchCountByRegexp(exp, box, path, typeFilter string) (matchedBlockCount, matchedRootCount int) {
fieldFilter := fieldRegexp(exp)
- stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `blocks` WHERE " + fieldFilter + " AND type IN " + filter
+ stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter
if "" != box {
stmt += " AND box = '" + box + "'"
}
if "" != path {
stmt += " AND path LIKE '" + path + "%'"
}
- stmt += " ORDER BY sort ASC LIMIT " + strconv.Itoa(Conf.Search.Limit)
+ stmt += " LIMIT " + strconv.Itoa(Conf.Search.Limit)
result, _ := sql.Query(stmt)
if 1 > len(result) {
return