mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
41e8fe8c03
15 changed files with 33 additions and 42 deletions
|
|
@ -975,7 +975,7 @@
|
|||
"49": "Please specify the daily note save path in the Notebook Settings",
|
||||
"50": "Resolving reference [%s]",
|
||||
"51": "Cache content block [%d]",
|
||||
"52": "Every time you open the user guide notebook data will be reset, so please do not save any data in it",
|
||||
"52": "Every time you start and open the user guide, the data in it will be reset, so please do not save any data in the user guide",
|
||||
"53": "Data synchronization has not been enabled",
|
||||
"54": "Indexing references...",
|
||||
"55": "Indexed references of [%d] documents",
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@
|
|||
"49": "Por favor, especifique la ruta de guardado de las notas diarias en la Configuración de la Libreta",
|
||||
"50": "Resolviendo referencia [%s]",
|
||||
"51": "Bloque de contenido de la caché [%d]",
|
||||
"52": "Cada vez que abra la guía del usuario se restablecerán los datos del cuaderno, así que no guarde ningún dato en ella",
|
||||
"52": "Cada vez que inicie y abra la guía del usuario, los datos que contiene se restablecerán, así que no guarde ningún dato en la guía del usuario",
|
||||
"53": "No se ha habilitado la sincronizacion de datos",
|
||||
"54": "Indexando referencias...",
|
||||
"55": "Referencias indexadas de [%d] documentos",
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@
|
|||
"49": "Veuillez spécifier le chemin d'enregistrement des notes quotidiennes dans les paramètres du carnet de notes.",
|
||||
"50": "Résolution des référence [%s]",
|
||||
"51": "Blocage du contenu du cache [%d]",
|
||||
"52": "Chaque fois que vous ouvrez le guide de l'utilisateur, les données du notebook seront réinitialisées, veuillez donc ne pas y enregistrer de données.",
|
||||
"52": "Chaque fois que vous démarrez et ouvrez le guide de l'utilisateur, les données qu'il contient seront réinitialisées, veuillez donc ne pas enregistrer de données dans le guide de l'utilisateur",
|
||||
"53": "La synchronisation des données n'a pas été activée",
|
||||
"54": "Indexation des références...",
|
||||
"55": "Références indexées de [%d] documents",
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@
|
|||
"49": "請在筆記本設置中指定日記存放路徑",
|
||||
"50": "正在解析引用 [%s]",
|
||||
"51": "正在快取內容塊 [%d]",
|
||||
"52": "每次打開使用者指南筆記本資料都會被重置,所以請勿在其中保存任何資料",
|
||||
"52": "每次啟動和打開用戶指南,其中的數據都會被重置,所以請勿在用戶指南中保存任何數據",
|
||||
"53": "數據同步尚未啟用",
|
||||
"54": "正在索引引用關係...",
|
||||
"55": "已完成索引 [%d] 篇文檔的引用關係",
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@
|
|||
"49": "请在笔记本设置中指定日记存放路径",
|
||||
"50": "正在解析引用 [%s]",
|
||||
"51": "正在缓存内容块 [%d]",
|
||||
"52": "每次打开用户指南笔记本数据都会被重置,所以请勿在其中保存任何数据",
|
||||
"52": "每次启动和打开用户指南,其中的数据都会被重置,所以请勿在用户指南中保存任何数据",
|
||||
"53": "数据同步尚未启用",
|
||||
"54": "正在索引引用关系...",
|
||||
"55": "已完成索引 [%d] 篇文档的引用关系",
|
||||
|
|
|
|||
|
|
@ -226,13 +226,6 @@ export const query = {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch" id="virtualRefDoc" type="checkbox"${window.siyuan.config.search.virtualRefDoc ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex" style="flex: 2">
|
||||
<div class=>
|
||||
${window.siyuan.languages.keywordsLimit}
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field" id="virtualRefKeywordsLimit" type="number" min="1" max="10240" value="${window.siyuan.config.search.virtualRefKeywordsLimit}">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="fn__flex b3-label config__item">
|
||||
|
|
@ -284,7 +277,6 @@ export const query = {
|
|||
virtualRefAlias: (query.element.querySelector("#virtualRefAlias") as HTMLInputElement).checked,
|
||||
virtualRefAnchor: (query.element.querySelector("#virtualRefAnchor") as HTMLInputElement).checked,
|
||||
virtualRefDoc: (query.element.querySelector("#virtualRefDoc") as HTMLInputElement).checked,
|
||||
virtualRefKeywordsLimit: parseInt((query.element.querySelector("#virtualRefKeywordsLimit") as HTMLInputElement).value),
|
||||
}, response => {
|
||||
window.siyuan.config.search = response.data;
|
||||
});
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -487,7 +487,6 @@ declare interface IConfig {
|
|||
virtualRefAlias: boolean
|
||||
virtualRefAnchor: boolean
|
||||
virtualRefDoc: boolean
|
||||
virtualRefKeywordsLimit: boolean
|
||||
},
|
||||
stat: {
|
||||
treeCount: number
|
||||
|
|
|
|||
4
app/stage/protyle/js/lute/lute.min.js
vendored
4
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -234,7 +234,6 @@ func setSearch(c *gin.Context) {
|
|||
oldVirtualRefAlias := model.Conf.Search.VirtualRefAlias
|
||||
oldVirtualRefAnchor := model.Conf.Search.VirtualRefAnchor
|
||||
oldVirtualRefDoc := model.Conf.Search.VirtualRefDoc
|
||||
oldVirtualRefKeywordsLimit := model.Conf.Search.VirtualRefKeywordsLimit
|
||||
|
||||
model.Conf.Search = s
|
||||
model.Conf.Save()
|
||||
|
|
@ -246,8 +245,7 @@ func setSearch(c *gin.Context) {
|
|||
if oldVirtualRefName != s.VirtualRefName ||
|
||||
oldVirtualRefAlias != s.VirtualRefAlias ||
|
||||
oldVirtualRefAnchor != s.VirtualRefAnchor ||
|
||||
oldVirtualRefDoc != s.VirtualRefDoc ||
|
||||
oldVirtualRefKeywordsLimit != s.VirtualRefKeywordsLimit {
|
||||
oldVirtualRefDoc != s.VirtualRefDoc {
|
||||
model.ResetVirtualBlockRefCache()
|
||||
}
|
||||
ret.Data = s
|
||||
|
|
|
|||
|
|
@ -52,11 +52,10 @@ type Search struct {
|
|||
BacklinkMentionDoc bool `json:"backlinkMentionDoc"`
|
||||
BacklinkMentionKeywordsLimit int `json:"backlinkMentionKeywordsLimit"`
|
||||
|
||||
VirtualRefName bool `json:"virtualRefName"`
|
||||
VirtualRefAlias bool `json:"virtualRefAlias"`
|
||||
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
||||
VirtualRefDoc bool `json:"virtualRefDoc"`
|
||||
VirtualRefKeywordsLimit int `json:"virtualRefKeywordsLimit"`
|
||||
VirtualRefName bool `json:"virtualRefName"`
|
||||
VirtualRefAlias bool `json:"virtualRefAlias"`
|
||||
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
||||
VirtualRefDoc bool `json:"virtualRefDoc"`
|
||||
}
|
||||
|
||||
func NewSearch() *Search {
|
||||
|
|
@ -88,11 +87,10 @@ func NewSearch() *Search {
|
|||
BacklinkMentionDoc: true,
|
||||
BacklinkMentionKeywordsLimit: 512,
|
||||
|
||||
VirtualRefName: true,
|
||||
VirtualRefAlias: false,
|
||||
VirtualRefAnchor: true,
|
||||
VirtualRefDoc: true,
|
||||
VirtualRefKeywordsLimit: 512,
|
||||
VirtualRefName: true,
|
||||
VirtualRefAlias: false,
|
||||
VirtualRefAnchor: true,
|
||||
VirtualRefDoc: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/88250/clipboard v0.1.5
|
||||
github.com/88250/css v0.1.2
|
||||
github.com/88250/gulu v1.2.3-0.20230223100136-26e5f16ac3c0
|
||||
github.com/88250/lute v1.7.6-0.20230303060605-b654e00909d4
|
||||
github.com/88250/lute v1.7.6-0.20230312150639-b30c6c3640ae
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230224021324-e51076eb6390
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20230220142845-f237b6348b3e
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
|
|||
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/88250/gulu v1.2.3-0.20230223100136-26e5f16ac3c0 h1:hZn2F/kNKcxoK41JhfoTfJ5BYHoWG3fSYk/BlOPYqLo=
|
||||
github.com/88250/gulu v1.2.3-0.20230223100136-26e5f16ac3c0/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
|
||||
github.com/88250/lute v1.7.6-0.20230303060605-b654e00909d4 h1:Iw6OJn6z20P3QNXMmacRKOvOAoQ0m56FYkqN5ldX8Js=
|
||||
github.com/88250/lute v1.7.6-0.20230303060605-b654e00909d4/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
|
||||
github.com/88250/lute v1.7.6-0.20230312150639-b30c6c3640ae h1:MlTS1TKPemjM1Dwr3nbU9ibFevJ8Dnfv+IIfPA96KBE=
|
||||
github.com/88250/lute v1.7.6-0.20230312150639-b30c6c3640ae/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230224021324-e51076eb6390 h1:q2AR33VoQ87WYtvZ4pEvwj5gZkv22HK/yMlPWwF1oyc=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230224021324-e51076eb6390/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
}
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '{content}:(")
|
||||
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '" + columnFilter() + ":(")
|
||||
for i, mentionKeyword := range mentionKeywords {
|
||||
if Conf.Search.BacklinkMentionKeywordsLimit < i {
|
||||
util.PushMsg(fmt.Sprintf(Conf.Language(38), len(mentionKeywords)), 5000)
|
||||
|
|
@ -688,7 +688,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
if !entering || n.IsBlock() {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
if ast.NodeText == n.Type {
|
||||
if ast.NodeText == n.Type { // 这里包含了标签命中的情况,因为 Lute 没有启用 TextMark
|
||||
textBuf.Write(n.Tokens)
|
||||
}
|
||||
return ast.WalkContinue
|
||||
|
|
@ -703,6 +703,14 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
newText := markReplaceSpanWithSplit(text, mentionKeywords, search.GetMarkSpanStart(search.MarkDataType), search.GetMarkSpanEnd())
|
||||
if text != newText {
|
||||
tmp = append(tmp, b)
|
||||
} else {
|
||||
// columnFilter 中的命名、别名和备注命中的情况
|
||||
// 反链提及搜索范围增加命名、别名和备注 https://github.com/siyuan-note/siyuan/issues/7639
|
||||
if gulu.Str.Contains(trimMarkTags(b.Name), mentionKeywords) ||
|
||||
gulu.Str.Contains(trimMarkTags(b.Alias), mentionKeywords) ||
|
||||
gulu.Str.Contains(trimMarkTags(b.Memo), mentionKeywords) {
|
||||
tmp = append(tmp, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
blocks = tmp
|
||||
|
|
@ -727,6 +735,10 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
return
|
||||
}
|
||||
|
||||
func trimMarkTags(str string) string {
|
||||
return strings.TrimSuffix(strings.TrimPrefix(str, "<mark>"), "</mark>")
|
||||
}
|
||||
|
||||
func getContainStr(str string, strs []string) string {
|
||||
str = strings.ToLower(str)
|
||||
for _, s := range strs {
|
||||
|
|
|
|||
|
|
@ -308,9 +308,6 @@ func InitConf() {
|
|||
if 1 > Conf.Search.BacklinkMentionKeywordsLimit {
|
||||
Conf.Search.BacklinkMentionKeywordsLimit = 512
|
||||
}
|
||||
if 1 > Conf.Search.VirtualRefKeywordsLimit {
|
||||
Conf.Search.VirtualRefKeywordsLimit = 512
|
||||
}
|
||||
|
||||
if nil == Conf.Stat {
|
||||
Conf.Stat = conf.NewStat()
|
||||
|
|
|
|||
|
|
@ -225,11 +225,6 @@ func getVirtualRefKeywords(docName string) (ret []string) {
|
|||
// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537
|
||||
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
||||
ret = prepareMarkKeywords(ret)
|
||||
|
||||
// 在 设置 - 搜索 中分别增加虚拟引用和反链提及 `关键字数量限制` https://github.com/siyuan-note/siyuan/issues/6603
|
||||
if Conf.Search.VirtualRefKeywordsLimit < len(ret) {
|
||||
ret = ret[:Conf.Search.VirtualRefKeywordsLimit]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue