🎨 虚拟引用搜索关键字最多支持 512
个 Fix https://github.com/siyuan-note/siyuan/issues/6603
This commit is contained in:
parent
30e58a474d
commit
d9e51448dc
1 changed files with 6 additions and 9 deletions
|
@ -109,20 +109,17 @@ func getVirtualRefKeywords(docName string) (ret []string) {
|
|||
// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537
|
||||
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
||||
ret = prepareMarkKeywords(ret)
|
||||
// 虚拟引用搜索关键字最多支持 `512` 个 https://github.com/siyuan-note/siyuan/issues/6603
|
||||
if 512 < len(ret) {
|
||||
ret = ret[:512]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func prepareMarkKeywords(keywords []string) (ret []string) {
|
||||
keywords = gulu.Str.RemoveDuplicatedElem(keywords)
|
||||
for _, k := range keywords {
|
||||
if strings.ContainsAny(k, "?*!@#$%^&()[]{}\\|;:'\",.<>~`") {
|
||||
continue
|
||||
}
|
||||
ret = append(ret, k)
|
||||
}
|
||||
|
||||
ret = gulu.Str.RemoveDuplicatedElem(keywords)
|
||||
sort.SliceStable(ret, func(i, j int) bool {
|
||||
return len(ret[i]) < len(ret[j])
|
||||
return len(ret[i]) > len(ret[j])
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue