mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
⚡ Improve block ref searching performance https://github.com/siyuan-note/siyuan/issues/11951
This commit is contained in:
parent
27f88c2482
commit
338ed572da
1 changed files with 6 additions and 1 deletions
|
|
@ -324,10 +324,15 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,
|
||||||
|
|
||||||
ignoreLines := getRefSearchIgnoreLines()
|
ignoreLines := getRefSearchIgnoreLines()
|
||||||
refs := sql.QueryRefsRecent(onlyDoc, ignoreLines)
|
refs := sql.QueryRefsRecent(onlyDoc, ignoreLines)
|
||||||
|
var btsID []string
|
||||||
|
for _, ref := range refs {
|
||||||
|
btsID = append(btsID, ref.DefBlockRootID)
|
||||||
|
}
|
||||||
|
bts := treenode.GetBlockTrees(btsID)
|
||||||
for _, ref := range refs {
|
for _, ref := range refs {
|
||||||
tree := cachedTrees[ref.DefBlockRootID]
|
tree := cachedTrees[ref.DefBlockRootID]
|
||||||
if nil == tree {
|
if nil == tree {
|
||||||
tree, _ = LoadTreeByBlockID(ref.DefBlockRootID)
|
tree, _ = loadTreeByBlockTree(bts[ref.DefBlockRootID])
|
||||||
}
|
}
|
||||||
if nil == tree {
|
if nil == tree {
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue