mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
⚡ Improve global searching (group by doc) performance https://github.com/siyuan-note/siyuan/issues/11951
This commit is contained in:
parent
338ed572da
commit
c79b56aef0
1 changed files with 9 additions and 1 deletions
|
|
@ -328,6 +328,7 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,
|
||||||
for _, ref := range refs {
|
for _, ref := range refs {
|
||||||
btsID = append(btsID, ref.DefBlockRootID)
|
btsID = append(btsID, ref.DefBlockRootID)
|
||||||
}
|
}
|
||||||
|
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
|
||||||
bts := treenode.GetBlockTrees(btsID)
|
bts := treenode.GetBlockTrees(btsID)
|
||||||
for _, ref := range refs {
|
for _, ref := range refs {
|
||||||
tree := cachedTrees[ref.DefBlockRootID]
|
tree := cachedTrees[ref.DefBlockRootID]
|
||||||
|
|
@ -369,6 +370,7 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,
|
||||||
for _, b := range ret {
|
for _, b := range ret {
|
||||||
btsID = append(btsID, b.RootID)
|
btsID = append(btsID, b.RootID)
|
||||||
}
|
}
|
||||||
|
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
|
||||||
bts := treenode.GetBlockTrees(btsID)
|
bts := treenode.GetBlockTrees(btsID)
|
||||||
for _, b := range ret {
|
for _, b := range ret {
|
||||||
tree := cachedTrees[b.RootID]
|
tree := cachedTrees[b.RootID]
|
||||||
|
|
@ -899,11 +901,17 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
|
||||||
rootMap := map[string]bool{}
|
rootMap := map[string]bool{}
|
||||||
var rootIDs []string
|
var rootIDs []string
|
||||||
contentSorts := map[string]int{}
|
contentSorts := map[string]int{}
|
||||||
|
var btsID []string
|
||||||
|
for _, b := range blocks {
|
||||||
|
btsID = append(btsID, b.RootID)
|
||||||
|
}
|
||||||
|
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
|
||||||
|
bts := treenode.GetBlockTrees(btsID)
|
||||||
for _, b := range blocks {
|
for _, b := range blocks {
|
||||||
if _, ok := rootMap[b.RootID]; !ok {
|
if _, ok := rootMap[b.RootID]; !ok {
|
||||||
rootMap[b.RootID] = true
|
rootMap[b.RootID] = true
|
||||||
rootIDs = append(rootIDs, b.RootID)
|
rootIDs = append(rootIDs, b.RootID)
|
||||||
tree, _ := LoadTreeByBlockID(b.RootID)
|
tree, _ := loadTreeByBlockTree(bts[b.RootID])
|
||||||
if nil == tree {
|
if nil == tree {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue