Skip to content

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

:art: Improve search result highlight and positioning https://github.com/siyuan-note/siyuan/issues/8274

Liang Ding535def1acf10
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 2c7ff6b161..1264e41cd9 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -673,7 +673,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
subTree := &parse.Tree{ID: rootID, Root: &ast.Node{Type: ast.NodeDocument}, Marks: tree.Marks}
var keywords []string
- if 0 == queryMethod || 1 == queryMethod { // 只有关键字搜索和查询语法搜索才支持高亮
+ if "" != query && (0 == queryMethod || 1 == queryMethod) { // 只有关键字搜索和查询语法搜索才支持高亮
if 0 == queryMethod {
query = stringQuery(query)
}