Skip to content

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

:art: Block ref search and global search results display reference counts https://github.com/siyuan-note/siyuan/issues/15721

Daniel1cac4ae55b24
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 4a58450612..d328142419 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -1323,12 +1323,24 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
var nodeIDs []string
for _, b := range ret {
- nodeIDs = append(nodeIDs, b.ID)
+ if 0 == groupBy {
+ nodeIDs = append(nodeIDs, b.ID)
+ } else {
+ for _, c := range b.Children {
+ nodeIDs = append(nodeIDs, c.ID)
+ }
+ }
}
refCount := sql.QueryRefCount(nodeIDs)
for _, b := range ret {
- b.RefCount = refCount[b.ID]
+ if 0 == groupBy {
+ b.RefCount = refCount[b.ID]
+ } else {
+ for _, c := range b.Children {
+ c.RefCount = refCount[c.ID]
+ }
+ }
}
return
}