From 750f0d9836505115ecbd9ba019a990f26e8eaa18 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 8 May 2026 11:14:03 +0800 Subject: [PATCH 1/2] :art: Add heading and list subtype filters to search https://github.com/siyuan-note/siyuan/pull/17597 Signed-off-by: Daniel <845765@qq.com> --- app/appearance/langs/hi_IN.json | 2 ++ app/appearance/langs/id_ID.json | 2 ++ app/appearance/langs/nl_NL.json | 2 ++ app/appearance/langs/th_TH.json | 2 ++ 4 files changed, 8 insertions(+) diff --git a/app/appearance/langs/hi_IN.json b/app/appearance/langs/hi_IN.json index eb58dde9e..52f47ef9a 100644 --- a/app/appearance/langs/hi_IN.json +++ b/app/appearance/langs/hi_IN.json @@ -1042,6 +1042,8 @@ "heading4": "शीर्षक 4", "heading5": "शीर्षक 5", "heading6": "शीर्षक 6", + "unorderedList": "अक्रमित सूची", + "searchSubTypeListTip": "सूची उपप्रकार (क्रमित/अक्रमित/कार्य) सूची आइटम पर भी लागू होते हैं", "outlineExpandLevel": "विस्तार स्तर", "expandAll": "सभी विस्तारित करें", "outlineKeepCurrentExpand": "वर्तमान विस्तार रखें", diff --git a/app/appearance/langs/id_ID.json b/app/appearance/langs/id_ID.json index eb0fe2f58..978650057 100644 --- a/app/appearance/langs/id_ID.json +++ b/app/appearance/langs/id_ID.json @@ -1042,6 +1042,8 @@ "heading4": "Judul 4", "heading5": "Judul 5", "heading6": "Judul 6", + "unorderedList": "Daftar Tidak Berurutan", + "searchSubTypeListTip": "Subtipe daftar (Berurutan/Tidak Berurutan/Tugas) juga berlaku untuk item daftar", "outlineExpandLevel": "Tingkat perluasan", "expandAll": "Perluas semua", "outlineKeepCurrentExpand": "Pertahankan perluasan saat ini", diff --git a/app/appearance/langs/nl_NL.json b/app/appearance/langs/nl_NL.json index 037a0e3be..27eb000e2 100644 --- a/app/appearance/langs/nl_NL.json +++ b/app/appearance/langs/nl_NL.json @@ -1042,6 +1042,8 @@ "heading4": "Kop 4", "heading5": "Kop 5", "heading6": "Kop 6", + "unorderedList": "Ongeordende Lijst", + "searchSubTypeListTip": "Lijstsubtypen (Geordend/Ongeordend/Taak) zijn ook van toepassing op lijstitems", "outlineExpandLevel": "Uitklapniveau", "expandAll": "Alles uitklappen", "outlineKeepCurrentExpand": "Huidig behouden", diff --git a/app/appearance/langs/th_TH.json b/app/appearance/langs/th_TH.json index cec908b82..e63340b81 100644 --- a/app/appearance/langs/th_TH.json +++ b/app/appearance/langs/th_TH.json @@ -1042,6 +1042,8 @@ "heading4": "หัวข้อ 4", "heading5": "หัวข้อ 5", "heading6": "หัวข้อ 6", + "unorderedList": "รายการไม่เรียงลำดับ", + "searchSubTypeListTip": "ชนิดย่อยของรายการ (เรียงลำดับ/ไม่เรียงลำดับ/งาน) ใช้กับรายการย่อยด้วย", "outlineExpandLevel": "ระดับขยาย", "expandAll": "ขยายทั้งหมด", "outlineKeepCurrentExpand": "คงขยาย", From fecd1bfe17efba2db4e06306f2e1298e5723fa73 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 8 May 2026 11:35:27 +0800 Subject: [PATCH 2/2] :art: Add heading and list subtype filters to search https://github.com/siyuan-note/siyuan/pull/17597 Signed-off-by: Daniel <845765@qq.com> --- kernel/api/filetree.go | 10 +++++++++- kernel/model/file.go | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go index 6c59be482..d11db7808 100644 --- a/kernel/api/filetree.go +++ b/kernel/api/filetree.go @@ -1146,6 +1146,14 @@ func getDoc(c *gin.Context) { queryTypes[t] = b.(bool) } } + var querySubTypes map[string]bool + if querySubTypesArg := arg["querySubTypes"]; nil != querySubTypesArg { + typesArg := querySubTypesArg.(map[string]any) + querySubTypes = map[string]bool{} + for t, b := range typesArg { + querySubTypes[t] = b.(bool) + } + } m := arg["mode"] // 0: 仅当前 ID,1:向上 2:向下,3:上下都加载,4:加载末尾 mode := 0 @@ -1186,7 +1194,7 @@ func getDoc(c *gin.Context) { } blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, keywords, err := - model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink, originalRefBlockIDs, highlight) + model.GetDoc(startID, endID, id, index, query, queryTypes, querySubTypes, queryMethod, mode, size, isBacklink, originalRefBlockIDs, highlight) if errors.Is(err, model.ErrBlockNotFound) { ret.Code = 3 return diff --git a/kernel/model/file.go b/kernel/model/file.go index 59fdfb586..32994704a 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -457,7 +457,7 @@ func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden boo return } -func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool, originalRefBlockIDs map[string]string, highlight bool) ( +func GetDoc(startID, endID, id string, index int, query string, queryTypes, querySubTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool, originalRefBlockIDs map[string]string, highlight bool) ( blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, keywords []string, err error) { //os.MkdirAll("pprof", 0755) //cpuProfile, _ := os.Create("pprof/GetDoc") @@ -653,7 +653,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s query = filterQueryInvisibleChars(query) if "" != query && (0 == queryMethod || 1 == queryMethod || 3 == queryMethod) { // 只有关键字、查询语法和正则表达式搜索支持高亮 - typeFilter := buildTypeFilter(queryTypes, nil) + typeFilter := buildTypeFilter(queryTypes, querySubTypes) switch queryMethod { case 0: query = stringQuery(query)