From 554f2f9fbcffaada20fb0179ee6df70849bb8e82 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sat, 22 Apr 2023 16:26:38 +0800 Subject: [PATCH] :art: Assets hyperlinks are no longer included in the search index Fix https://github.com/siyuan-note/siyuan/issues/8076 --- kernel/treenode/node.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 57710f269..535445819 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -185,9 +185,11 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi buf.WriteByte(' ') } if nil != linkDest { - buf.Write(linkDest.Tokens) - buf.WriteByte(' ') - + if !bytes.HasPrefix(linkDest.Tokens, []byte("assets/")) { + // Assets hyperlinks are no longer included in the search index https://github.com/siyuan-note/siyuan/issues/8076 + buf.Write(linkDest.Tokens) + buf.WriteByte(' ') + } } if linkTitle := n.ChildByType(ast.NodeLinkTitle); nil != linkTitle { buf.Write(linkTitle.Tokens) @@ -229,7 +231,11 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi if "" != n.TextMarkATitle { buf.WriteString(" " + n.TextMarkATitle) } - buf.WriteString(" " + n.TextMarkAHref) + + if !strings.HasPrefix(n.TextMarkAHref, "assets/") { + // Assets hyperlinks are no longer included in the search index https://github.com/siyuan-note/siyuan/issues/8076 + buf.WriteString(" " + n.TextMarkAHref) + } } case ast.NodeBackslash: buf.WriteByte(lex.ItemBackslash)