An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve search highlighting https://github.com/siyuan-note/siyuan/issues/13343
Daniel08e3b6b82f86
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.goindex 030c8dc3e4..3b69b1793a 100644--- a/kernel/api/filetree.go+++ b/kernel/api/filetree.go@@ -1120,7 +1120,7 @@ func getDoc(c *gin.Context) {highlight = highlightArg.(bool)}- blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, err :=+ blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, keywords, err :=model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink, highlight)if model.ErrBlockNotFound == err {ret.Code = 3@@ -1151,6 +1151,7 @@ func getDoc(c *gin.Context) {"path": docPath,"isSyncing": isSyncing,"isBacklinkExpand": isBacklinkExpand,+ "keywords": keywords,}}diff --git a/kernel/model/file.go b/kernel/model/file.goindex b8a3436516..f86f247749 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -599,7 +599,8 @@ func StatTree(id string) (ret *util.BlockStatResult) {}}-func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink, highlight bool) (blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, err error) {+func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink, highlight bool) (+ blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, keywords []string, err error) {//os.MkdirAll("pprof", 0755)//cpuProfile, _ := os.Create("pprof/GetDoc")//pprof.StartCPUProfile(cpuProfile)@@ -800,7 +801,6 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[ssubTree := &parse.Tree{ID: rootID, Root: &ast.Node{Type: ast.NodeDocument}, Marks: tree.Marks}- var keywords []stringif "" != query && (0 == queryMethod || 1 == queryMethod || 3 == queryMethod) { // 只有关键字、查询语法和正则表达式搜索支持高亮if 0 == queryMethod {query = stringQuery(query)