mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-23 08:46:09 +01:00
🎨 在 设置 - 搜索 中分别增加虚拟引用和反链提及 最大关键字数量限制 https://github.com/siyuan-note/siyuan/issues/6603
This commit is contained in:
parent
1bb3870243
commit
87fde9a1e8
9 changed files with 19 additions and 9 deletions
|
|
@ -737,7 +737,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
buf := bytes.Buffer{}
|
||||
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '{content}:(")
|
||||
for i, mentionKeyword := range mentionKeywords {
|
||||
if 511 < i { // 提及搜索最大限制 https://github.com/siyuan-note/siyuan/issues/3715
|
||||
if Conf.Search.BacklinkMentionLimit < i {
|
||||
util.PushMsg(fmt.Sprintf(Conf.Language(38), len(mentionKeywords)), 5000)
|
||||
mentionKeyword = strings.ReplaceAll(mentionKeyword, "\"", "\"\"")
|
||||
buf.WriteString("\"" + mentionKeyword + "\"")
|
||||
|
|
|
|||
|
|
@ -278,6 +278,12 @@ func InitConf() {
|
|||
if 1 > Conf.Search.Limit {
|
||||
Conf.Search.Limit = 64
|
||||
}
|
||||
if 1 > Conf.Search.BacklinkMentionLimit {
|
||||
Conf.Search.BacklinkMentionLimit = 512
|
||||
}
|
||||
if 1 > Conf.Search.VirtualRefLimit {
|
||||
Conf.Search.VirtualRefLimit = 512
|
||||
}
|
||||
|
||||
if nil == Conf.Stat {
|
||||
Conf.Stat = conf.NewStat()
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ func getVirtualRefKeywords(docName string) (ret []string) {
|
|||
// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537
|
||||
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
||||
ret = prepareMarkKeywords(ret)
|
||||
// 虚拟引用搜索关键字最多支持 `搜索结果显示数` 的 8 倍 https://github.com/siyuan-note/siyuan/issues/6603
|
||||
if Conf.Search.Limit*8 < len(ret) {
|
||||
ret = ret[:Conf.Search.Limit*8]
|
||||
|
||||
if Conf.Search.VirtualRefLimit < len(ret) {
|
||||
ret = ret[:Conf.Search.VirtualRefLimit]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue