mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 在 设置 - 搜索 中分别增加虚拟引用和反链提及 关键字数量限制 https://github.com/siyuan-note/siyuan/issues/6603
This commit is contained in:
parent
87fde9a1e8
commit
deba07c4ad
11 changed files with 48 additions and 28 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"keywordsLimit": "Keywords Limit",
|
||||||
"exportAsImage": "Export as image",
|
"exportAsImage": "Export as image",
|
||||||
"exportBySiYuan": "Export by SiYuan",
|
"exportBySiYuan": "Export by SiYuan",
|
||||||
"featureBetaStage": "This feature support is currently in the free public beta stage, and there is no clear charging plan yet, please know",
|
"featureBetaStage": "This feature support is currently in the free public beta stage, and there is no clear charging plan yet, please know",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"keywordsLimit": "Límite de palabras clave",
|
||||||
"exportAsImage": "Exportar como imagen",
|
"exportAsImage": "Exportar como imagen",
|
||||||
"exportBySiYuan": "Exportar por SiYuan",
|
"exportBySiYuan": "Exportar por SiYuan",
|
||||||
"featureBetaStage": "El soporte de esta función se encuentra actualmente en la etapa beta pública gratuita, y aún no hay un plan de carga claro, tenga en cuenta",
|
"featureBetaStage": "El soporte de esta función se encuentra actualmente en la etapa beta pública gratuita, y aún no hay un plan de carga claro, tenga en cuenta",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"keywordsLimit": "Limite de mots clés",
|
||||||
"exportAsImage": "Exporter en tant qu'image",
|
"exportAsImage": "Exporter en tant qu'image",
|
||||||
"exportBySiYuan": "Exporter par SiYuan",
|
"exportBySiYuan": "Exporter par SiYuan",
|
||||||
"featureBetaStage": "La prise en charge de cette fonctionnalité est actuellement en phase de bêta publique gratuite et il n'y a pas encore de plan de facturation clair, veuillez savoir",
|
"featureBetaStage": "La prise en charge de cette fonctionnalité est actuellement en phase de bêta publique gratuite et il n'y a pas encore de plan de facturation clair, veuillez savoir",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"keywordsLimit": "關鍵字數量限制",
|
||||||
"exportAsImage": "導出為圖片",
|
"exportAsImage": "導出為圖片",
|
||||||
"exportBySiYuan": "由思源筆記導出",
|
"exportBySiYuan": "由思源筆記導出",
|
||||||
"featureBetaStage": "該特性支持目前處於免費公測階段,目前尚未有明確的收費計劃,請悉知",
|
"featureBetaStage": "該特性支持目前處於免費公測階段,目前尚未有明確的收費計劃,請悉知",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"keywordsLimit": "关键字数量限制",
|
||||||
"exportAsImage": "导出为图片",
|
"exportAsImage": "导出为图片",
|
||||||
"exportBySiYuan": "由思源笔记导出",
|
"exportBySiYuan": "由思源笔记导出",
|
||||||
"featureBetaStage": "该特性支持目前处于免费公测阶段,目前尚未有明确的收费计划,请悉知",
|
"featureBetaStage": "该特性支持目前处于免费公测阶段,目前尚未有明确的收费计划,请悉知",
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,10 @@ export const query = {
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<input class="b3-switch fn__flex-center" id="backlinkMentionDoc" type="checkbox"${window.siyuan.config.search.backlinkMentionDoc ? " checked" : ""}/>
|
<input class="b3-switch fn__flex-center" id="backlinkMentionDoc" type="checkbox"${window.siyuan.config.search.backlinkMentionDoc ? " checked" : ""}/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
${window.siyuan.languages.keywordsLimit}
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-text-field fn__flex-center fn__size200" id="backlinkMentionKeywordsLimit" type="number" min="1" max="10240" value="${window.siyuan.config.search.backlinkMentionKeywordsLimit}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="b3-label">
|
<div class="b3-label">
|
||||||
|
|
@ -182,7 +186,14 @@ export const query = {
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<input class="b3-switch fn__flex-center" id="virtualRefDoc" type="checkbox"${window.siyuan.config.search.virtualRefDoc ? " checked" : ""}/>
|
<input class="b3-switch fn__flex-center" id="virtualRefDoc" type="checkbox"${window.siyuan.config.search.virtualRefDoc ? " checked" : ""}/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
|
||||||
|
<label class="fn__flex">
|
||||||
|
<div class="fn__flex-1 b3-label__text">
|
||||||
|
${window.siyuan.languages.keywordsLimit}
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-text-field fn__flex-center fn__size200" id="virtualRefKeywordsLimit" type="number" min="1" max="10240" value="${window.siyuan.config.search.virtualRefKeywordsLimit}">
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<label class="fn__flex b3-label">
|
<label class="fn__flex b3-label">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
|
|
@ -226,10 +237,12 @@ export const query = {
|
||||||
backlinkMentionAlias: (query.element.querySelector("#backlinkMentionAlias") as HTMLInputElement).checked,
|
backlinkMentionAlias: (query.element.querySelector("#backlinkMentionAlias") as HTMLInputElement).checked,
|
||||||
backlinkMentionAnchor: (query.element.querySelector("#backlinkMentionAnchor") as HTMLInputElement).checked,
|
backlinkMentionAnchor: (query.element.querySelector("#backlinkMentionAnchor") as HTMLInputElement).checked,
|
||||||
backlinkMentionDoc: (query.element.querySelector("#backlinkMentionDoc") as HTMLInputElement).checked,
|
backlinkMentionDoc: (query.element.querySelector("#backlinkMentionDoc") as HTMLInputElement).checked,
|
||||||
|
backlinkMentionKeywordsLimit: parseInt((query.element.querySelector("#backlinkMentionKeywordsLimit") as HTMLInputElement).value),
|
||||||
virtualRefName: (query.element.querySelector("#virtualRefName") as HTMLInputElement).checked,
|
virtualRefName: (query.element.querySelector("#virtualRefName") as HTMLInputElement).checked,
|
||||||
virtualRefAlias: (query.element.querySelector("#virtualRefAlias") as HTMLInputElement).checked,
|
virtualRefAlias: (query.element.querySelector("#virtualRefAlias") as HTMLInputElement).checked,
|
||||||
virtualRefAnchor: (query.element.querySelector("#virtualRefAnchor") as HTMLInputElement).checked,
|
virtualRefAnchor: (query.element.querySelector("#virtualRefAnchor") as HTMLInputElement).checked,
|
||||||
virtualRefDoc: (query.element.querySelector("#virtualRefDoc") as HTMLInputElement).checked,
|
virtualRefDoc: (query.element.querySelector("#virtualRefDoc") as HTMLInputElement).checked,
|
||||||
|
virtualRefKeywordsLimit: parseInt((query.element.querySelector("#virtualRefKeywordsLimit") as HTMLInputElement).value),
|
||||||
}, response => {
|
}, response => {
|
||||||
window.siyuan.config.search = response.data;
|
window.siyuan.config.search = response.data;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
|
@ -414,10 +414,12 @@ declare interface IConfig {
|
||||||
backlinkMentionAlias: boolean
|
backlinkMentionAlias: boolean
|
||||||
backlinkMentionAnchor: boolean
|
backlinkMentionAnchor: boolean
|
||||||
backlinkMentionDoc: boolean
|
backlinkMentionDoc: boolean
|
||||||
|
backlinkMentionKeywordsLimit: boolean
|
||||||
virtualRefName: boolean
|
virtualRefName: boolean
|
||||||
virtualRefAlias: boolean
|
virtualRefAlias: boolean
|
||||||
virtualRefAnchor: boolean
|
virtualRefAnchor: boolean
|
||||||
virtualRefDoc: boolean
|
virtualRefDoc: boolean
|
||||||
|
virtualRefKeywordsLimit: boolean
|
||||||
},
|
},
|
||||||
stat: {
|
stat: {
|
||||||
treeCount: number
|
treeCount: number
|
||||||
|
|
|
||||||
|
|
@ -45,17 +45,17 @@ type Search struct {
|
||||||
Memo bool `json:"memo"`
|
Memo bool `json:"memo"`
|
||||||
Custom bool `json:"custom"`
|
Custom bool `json:"custom"`
|
||||||
|
|
||||||
BacklinkMentionName bool `json:"backlinkMentionName"`
|
BacklinkMentionName bool `json:"backlinkMentionName"`
|
||||||
BacklinkMentionAlias bool `json:"backlinkMentionAlias"`
|
BacklinkMentionAlias bool `json:"backlinkMentionAlias"`
|
||||||
BacklinkMentionAnchor bool `json:"backlinkMentionAnchor"`
|
BacklinkMentionAnchor bool `json:"backlinkMentionAnchor"`
|
||||||
BacklinkMentionDoc bool `json:"backlinkMentionDoc"`
|
BacklinkMentionDoc bool `json:"backlinkMentionDoc"`
|
||||||
BacklinkMentionLimit int `json:"backlinkMentionLimit"`
|
BacklinkMentionKeywordsLimit int `json:"backlinkMentionKeywordsLimit"`
|
||||||
|
|
||||||
VirtualRefName bool `json:"virtualRefName"`
|
VirtualRefName bool `json:"virtualRefName"`
|
||||||
VirtualRefAlias bool `json:"virtualRefAlias"`
|
VirtualRefAlias bool `json:"virtualRefAlias"`
|
||||||
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
||||||
VirtualRefDoc bool `json:"virtualRefDoc"`
|
VirtualRefDoc bool `json:"virtualRefDoc"`
|
||||||
VirtualRefLimit int `json:"virtualRefLimit"`
|
VirtualRefKeywordsLimit int `json:"virtualRefKeywordsLimit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSearch() *Search {
|
func NewSearch() *Search {
|
||||||
|
|
@ -80,17 +80,17 @@ func NewSearch() *Search {
|
||||||
Memo: true,
|
Memo: true,
|
||||||
Custom: false,
|
Custom: false,
|
||||||
|
|
||||||
BacklinkMentionName: true,
|
BacklinkMentionName: true,
|
||||||
BacklinkMentionAlias: false,
|
BacklinkMentionAlias: false,
|
||||||
BacklinkMentionAnchor: true,
|
BacklinkMentionAnchor: true,
|
||||||
BacklinkMentionDoc: true,
|
BacklinkMentionDoc: true,
|
||||||
BacklinkMentionLimit: 512,
|
BacklinkMentionKeywordsLimit: 512,
|
||||||
|
|
||||||
VirtualRefName: true,
|
VirtualRefName: true,
|
||||||
VirtualRefAlias: false,
|
VirtualRefAlias: false,
|
||||||
VirtualRefAnchor: true,
|
VirtualRefAnchor: true,
|
||||||
VirtualRefDoc: true,
|
VirtualRefDoc: true,
|
||||||
VirtualRefLimit: 512,
|
VirtualRefKeywordsLimit: 512,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -737,7 +737,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '{content}:(")
|
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '{content}:(")
|
||||||
for i, mentionKeyword := range mentionKeywords {
|
for i, mentionKeyword := range mentionKeywords {
|
||||||
if Conf.Search.BacklinkMentionLimit < i {
|
if Conf.Search.BacklinkMentionKeywordsLimit < i {
|
||||||
util.PushMsg(fmt.Sprintf(Conf.Language(38), len(mentionKeywords)), 5000)
|
util.PushMsg(fmt.Sprintf(Conf.Language(38), len(mentionKeywords)), 5000)
|
||||||
mentionKeyword = strings.ReplaceAll(mentionKeyword, "\"", "\"\"")
|
mentionKeyword = strings.ReplaceAll(mentionKeyword, "\"", "\"\"")
|
||||||
buf.WriteString("\"" + mentionKeyword + "\"")
|
buf.WriteString("\"" + mentionKeyword + "\"")
|
||||||
|
|
|
||||||
|
|
@ -278,11 +278,11 @@ func InitConf() {
|
||||||
if 1 > Conf.Search.Limit {
|
if 1 > Conf.Search.Limit {
|
||||||
Conf.Search.Limit = 64
|
Conf.Search.Limit = 64
|
||||||
}
|
}
|
||||||
if 1 > Conf.Search.BacklinkMentionLimit {
|
if 1 > Conf.Search.BacklinkMentionKeywordsLimit {
|
||||||
Conf.Search.BacklinkMentionLimit = 512
|
Conf.Search.BacklinkMentionKeywordsLimit = 512
|
||||||
}
|
}
|
||||||
if 1 > Conf.Search.VirtualRefLimit {
|
if 1 > Conf.Search.VirtualRefKeywordsLimit {
|
||||||
Conf.Search.VirtualRefLimit = 512
|
Conf.Search.VirtualRefKeywordsLimit = 512
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == Conf.Stat {
|
if nil == Conf.Stat {
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@ func getVirtualRefKeywords(docName string) (ret []string) {
|
||||||
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
||||||
ret = prepareMarkKeywords(ret)
|
ret = prepareMarkKeywords(ret)
|
||||||
|
|
||||||
if Conf.Search.VirtualRefLimit < len(ret) {
|
if Conf.Search.VirtualRefKeywordsLimit < len(ret) {
|
||||||
ret = ret[:Conf.Search.VirtualRefLimit]
|
ret = ret[:Conf.Search.VirtualRefKeywordsLimit]
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue