An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 在 设置 - 搜索 中分别增加虚拟引用和反链提及 `最大关键字数量限制` https://github.com/siyuan-note/siyuan/issues/6603
Liang Ding87fde9a1e87c
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex af6a9c1c34..2af5c263bf 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -864,7 +864,7 @@"35": "Rebuilding index, please wait...","36": "There is too much content in the historical document, in order not to affect performance, it has been switched to plain text display","37": "Do not include spaces and special symbols in the name of the cloud sync directory",- "38": "The number of mentioned keywords [%d] is too many, currently only supports up to [512] keywords",+ "38": "Too many keywords mentioned [%d], adjust if necessary [Settings - Search - Backlink Mentions - Keyword Limit]","39": "Deleting index %s","40": "Inserting index %s","41": "Upload completed",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex a4d82cfb7f..f2c62fccc8 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -864,7 +864,7 @@"35": "Reconstruyendo el índice, por favor espere...","36": "Hay demasiado contenido en el documento historico, para no afectar el rendimiento, se ha cambiado a visualizacion de texto sin formato","37": "No incluyas espacios ni símbolos especiales en el nombre del directorio de sincronización con la nube",- "38": "El número de palabras clave mencionadas [%d] son demasiados, actualmente solo admite hasta [512] palabras clave",+ "38": "Demasiadas palabras clave mencionadas [%d], ajústelas si es necesario [Configuración - Búsqueda - Menciones de backlinks - Límite de palabras clave]","39": "Eliminando índice %s","40": "Insertando índice %s","41": "Carga completada",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 778429ea38..ab4fad965f 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -864,7 +864,7 @@"35": "Recréation de l'index, veuillez patienter...","36": "Il y a trop de contenu dans le document historique, afin de ne pas affecter les performances, il a été basculé sur l'affichage en texte brut","37": "N'incluez pas d'espaces et de symboles spéciaux dans le nom du répertoire de synchronisation cloud",- "38": "Le nombre de mots-clés mentionnés [%d] est trop élevé, ne prend actuellement en charge que jusqu'à [512] mots-clés",+ "38": "Trop de mots-clés mentionnés [%d], ajustez si nécessaire [Paramètres - Recherche - Mentions de backlink - Limite de mots-clés]","39": "Suppression de l'index %s","40": "Insertion de l'index %s","41": "Transfert complété",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 9f79610883..eb234e307e 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -864,7 +864,7 @@"35": "正在重建索引,請稍等...","36": "歷史文檔內容太多,為了不影響性能,已經切換為純文本顯示","37": "雲端同步目錄的名稱請勿包含空格和特殊符號",- "38": "提及關鍵字數量 [%d] 過多,目前最多僅支援搜索 [512] 個關鍵字",+ "38": "提及關鍵字數量 [%d] 過多,如有需要可以調整 [設置 - 搜索 - 反鏈提及 - 關鍵字數量限制]","39": "正在刪除索引 %s","40": "正在插入索引 %s","41": "上傳完畢",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 9f7e30bd1c..cd6e26e82f 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -864,7 +864,7 @@"35": "正在重建索引,请稍等...","36": "历史文档内容太多,为了不影响性能,已经切换为纯文本显示","37": "云端同步目录的名称请勿包含空格和特殊符号",- "38": "提及关键字数量 [%d] 过多,目前最多仅支持搜索 [512] 个关键字",+ "38": "提及关键字数量 [%d] 过多,如有需要可以调整 [设置 - 搜索 - 反链提及 - 关键字数量限制]","39": "正在删除索引 %s","40": "正在插入索引 %s","41": "上传完毕",diff --git a/kernel/conf/search.go b/kernel/conf/search.goindex c85d368faa..a9e1cf7406 100644--- a/kernel/conf/search.go+++ b/kernel/conf/search.go@@ -49,11 +49,13 @@ type Search struct {BacklinkMentionAlias bool `json:"backlinkMentionAlias"`BacklinkMentionAnchor bool `json:"backlinkMentionAnchor"`BacklinkMentionDoc bool `json:"backlinkMentionDoc"`+ BacklinkMentionLimit int `json:"backlinkMentionLimit"`VirtualRefName bool `json:"virtualRefName"`VirtualRefAlias bool `json:"virtualRefAlias"`VirtualRefAnchor bool `json:"virtualRefAnchor"`VirtualRefDoc bool `json:"virtualRefDoc"`+ VirtualRefLimit int `json:"virtualRefLimit"`}func NewSearch() *Search {@@ -82,11 +84,13 @@ func NewSearch() *Search {BacklinkMentionAlias: false,BacklinkMentionAnchor: true,BacklinkMentionDoc: true,+ BacklinkMentionLimit: 512,VirtualRefName: true,VirtualRefAlias: false,VirtualRefAnchor: true,VirtualRefDoc: true,+ VirtualRefLimit: 512,}}diff --git a/kernel/model/backlink.go b/kernel/model/backlink.goindex 66da9cc011..372c3d817c 100644--- a/kernel/model/backlink.go+++ b/kernel/model/backlink.go@@ -737,7 +737,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklinkbuf := 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 + "\"")diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 52c5b9af1e..2576ca6ca9 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -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()diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.goindex 0e7614955f..4fa5173d02 100644--- a/kernel/model/virutalref.go+++ b/kernel/model/virutalref.go@@ -109,9 +109,9 @@ func getVirtualRefKeywords(docName string) (ret []string) {// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537ret = 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}