From 50c9616d7b10609dafeaa0b943d4583af420130b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 19 Jan 2023 01:16:13 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=B5=8C=E5=85=A5=E5=9D=97=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=90=9C=E7=B4=A2=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/7112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/search.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/model/search.go b/kernel/model/search.go index d6f140836..0ba4dad2a 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -58,6 +58,11 @@ func searchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMod sqlBlocks := sql.SelectBlocksRawStmtNoParse(stmt, Conf.Search.Limit) var tmp []*sql.Block for _, b := range sqlBlocks { + if "query_embed" == b.Type { // 嵌入块不再嵌入 + // 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112 + // 这里会导致上面的 limit 限制不准确,导致结果变少,暂时没有解决方案,只能靠用户自己调整 SQL,加上 type != 'query_embed' 的条件 + continue + } if !gulu.Str.Contains(b.ID, excludeIDs) { tmp = append(tmp, b) } @@ -494,6 +499,7 @@ func buildTypeFilter(types map[string]bool) string { s.SuperBlock = types["superBlock"] s.Paragraph = types["paragraph"] s.HTMLBlock = types["htmlBlock"] + s.EmbedBlock = types["embedBlock"] } else { s.Document = Conf.Search.Document s.Heading = Conf.Search.Heading @@ -506,6 +512,7 @@ func buildTypeFilter(types map[string]bool) string { s.SuperBlock = Conf.Search.SuperBlock s.Paragraph = Conf.Search.Paragraph s.HTMLBlock = Conf.Search.HTMLBlock + s.EmbedBlock = Conf.Search.EmbedBlock } return s.TypeFilter() }