Skip to content

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

:bug: No results found after clicking on the inline tag https://github.com/siyuan-note/siyuan/issues/13351

Daniel2e148ef6b131
diff --git a/kernel/model/search.go b/kernel/model/search.go
index dd50121e4d..8033f0d30a 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -976,6 +976,7 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
return
}
+ query = filterQueryInvisibleChars(query)
trimQuery := strings.TrimSpace(query)
if "" != trimQuery {
query = trimQuery
@@ -1223,7 +1224,6 @@ func buildTypeFilter(types map[string]bool) string {
}
func searchBySQL(stmt string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
- stmt = filterQueryInvisibleChars(stmt)
stmt = strings.TrimSpace(stmt)
blocks := sql.SelectBlocksRawStmt(stmt, page, pageSize)
ret = fromSQLBlocks(&blocks, "", beforeLen)
@@ -1348,7 +1348,6 @@ func extractID(content string) (ret string) {
}
func fullTextSearchByQuerySyntax(query, boxFilter, pathFilter, typeFilter, ignoreFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
- query = filterQueryInvisibleChars(query)
if ast.IsNodeIDPattern(query) {
ret, matchedBlockCount, matchedRootCount = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+query+"'", beforeLen, page, pageSize)
return
@@ -1357,7 +1356,6 @@ func fullTextSearchByQuerySyntax(query, boxFilter, pathFilter, typeFilter, ignor
}
func fullTextSearchByKeyword(query, boxFilter, pathFilter, typeFilter, ignoreFilter string, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
- query = filterQueryInvisibleChars(query)
if ast.IsNodeIDPattern(query) {
ret, matchedBlockCount, matchedRootCount = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+query+"'", beforeLen, page, pageSize)
return
@@ -1366,8 +1364,6 @@ func fullTextSearchByKeyword(query, boxFilter, pathFilter, typeFilter, ignoreFil
}
func fullTextSearchByRegexp(exp, boxFilter, pathFilter, typeFilter, ignoreFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
- exp = filterQueryInvisibleChars(exp)
-
fieldFilter := fieldRegexp(exp)
stmt := "SELECT * FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter
stmt += boxFilter + pathFilter + ignoreFilter + " " + orderBy
diff --git a/kernel/util/rune.go b/kernel/util/rune.go
index 232e6bcbf6..77de77a07f 100644
--- a/kernel/util/rune.go
+++ b/kernel/util/rune.go
@@ -62,6 +62,6 @@ func RemoveEmojiInvisible(text string) (ret string) {
func RemoveInvalid(text string) (ret string) {
ret = gulu.Str.RemoveInvisible(text)
- ret = gulu.Str.RemovePUA(text)
+ ret = gulu.Str.RemovePUA(ret)
return
}