From f4f08b1fcf4a5ea53a1705ed96bd7c8aa342a941 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 16 Feb 2023 15:06:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:bug:=20=E5=85=B3=E7=B3=BB=E5=9B=BE?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=85=B3=E8=81=94=E4=B8=A2=E5=A4=B1=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/7383?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/graph.go | 21 ++++++++++++--------- kernel/sql/block_ref_query.go | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/kernel/model/graph.go b/kernel/model/graph.go index 30be916f3..57894978d 100644 --- a/kernel/model/graph.go +++ b/kernel/model/graph.go @@ -113,23 +113,26 @@ func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links [ rootIDs = append(rootIDs, rootDef.ID) } - sqlRootRefBlocks := sql.QueryRefRootBlocksByDefRootIDs(rootIDs) - for defRootID, sqlRefBlocks := range sqlRootRefBlocks { + sqlRefBlocks := sql.QueryRefRootBlocksByDefRootIDs(rootIDs) + for defRootID, sqlRefBlocks := range sqlRefBlocks { rootBlock := getBlockIn(rootDefBlocks, defRootID) if nil == rootBlock { continue } - refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0) - rootBlock.Refs = append(rootBlock.Refs, refBlocks...) - } - - // 按定义处理 - sqlRootRefBlocks = sql.QueryRefRootBlocksByDefRootIDs([]string{rootID}) - for _, sqlRefBlocks := range sqlRootRefBlocks { blocks = append(blocks, rootBlock) refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0) rootBlock.Refs = append(rootBlock.Refs, refBlocks...) + blocks = append(blocks, refBlocks...) + } + + // 按定义处理 + sqlRefBlocks = sql.QueryRefRootBlocksByDefRootIDs([]string{rootID}) + for _, sqlRefBlocks := range sqlRefBlocks { + blocks = append(blocks, rootBlock) + refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0) + rootBlock.Refs = append(rootBlock.Refs, refBlocks...) + blocks = append(blocks, refBlocks...) } } } diff --git a/kernel/sql/block_ref_query.go b/kernel/sql/block_ref_query.go index 93b066e0f..80cde1f18 100644 --- a/kernel/sql/block_ref_query.go +++ b/kernel/sql/block_ref_query.go @@ -170,7 +170,7 @@ func QueryRefRootBlocksByDefRootIDs(defRootIDs []string) (ret map[string][]*Bloc } if nil == ret[defRootID] { - ret[defRootID] = []*Block{} + ret[defRootID] = []*Block{&block} } else { ret[defRootID] = append(ret[defRootID], &block) } From 5ca70f519551065c893c35aec4b12058df1d1a43 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 16 Feb 2023 15:12:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:art:=20`=E6=90=9C=E7=B4=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=98=BE=E7=A4=BA=E6=95=B0`=20=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=BA=2032=20https://github.com/siyuan-no?= =?UTF-8?q?te/siyuan/issues/7384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/setting.go | 4 ++-- kernel/model/conf.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/api/setting.go b/kernel/api/setting.go index 13e870b2e..a69c07528 100644 --- a/kernel/api/setting.go +++ b/kernel/api/setting.go @@ -209,8 +209,8 @@ func setSearch(c *gin.Context) { return } - if 1 > s.Limit { - s.Limit = 64 + if 32 > s.Limit { + s.Limit = 32 } oldCaseSensitive := model.Conf.Search.CaseSensitive diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 722d61040..ee3e50f90 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -293,6 +293,9 @@ func InitConf() { if 1 > Conf.Search.Limit { Conf.Search.Limit = 64 } + if 32 > Conf.Search.Limit { + Conf.Search.Limit = 32 + } if 1 > Conf.Search.BacklinkMentionKeywordsLimit { Conf.Search.BacklinkMentionKeywordsLimit = 512 } From de3cddd218495b76682ac8cb03ab4261fc33d0d9 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 16 Feb 2023 15:14:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:art:=20`=E6=90=9C=E7=B4=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=98=BE=E7=A4=BA=E6=95=B0`=20=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=BA=2032=20https://github.com/siyuan-no?= =?UTF-8?q?te/siyuan/issues/7384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/config/query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/config/query.ts b/app/src/config/query.ts index d275c5d75..662d1903d 100644 --- a/app/src/config/query.ts +++ b/app/src/config/query.ts @@ -242,7 +242,7 @@ export const query = {
${window.siyuan.languages.searchLimit2}
- +