Skip to content

Commit

Permalink
🎨 Show notebooks in hpath of block ref search list results siyuan-not…
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 9, 2023
1 parent 4965b7b commit 288eb24
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kernel/model/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets
if 1 > len(ret) {
ret = []*Block{}
}

// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
prependNotebookNameInHPath(ret)
return
}

Expand Down Expand Up @@ -205,9 +208,25 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets
newDoc = nil == treenode.GetBlockTreeRootByHPath(block.BoxID, p)
}
}

// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
prependNotebookNameInHPath(ret)
return
}

func prependNotebookNameInHPath(blocks []*Block) {
var boxIDs []string
for _, b := range blocks {
boxIDs = append(boxIDs, b.Box)
}
boxIDs = gulu.Str.RemoveDuplicatedElem(boxIDs)
boxNames := Conf.BoxNames(boxIDs)
for _, b := range blocks {
name := boxNames[b.Box]
b.HPath = name + b.HPath
}
}

func FindReplace(keyword, replacement string, ids []string, paths, boxes []string, types map[string]bool, method, orderBy, groupBy int) (err error) {
// method:0:文本,1:查询语法,2:SQL,3:正则表达式
if 1 == method || 2 == method {
Expand Down

0 comments on commit 288eb24

Please sign in to comment.