An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve backlink filtering below the heading https://github.com/siyuan-note/siyuan/issues/14929
Danielc2c4c2393f71
diff --git a/kernel/model/backlink.go b/kernel/model/backlink.goindex ea25433038..9f38e28196 100644--- a/kernel/model/backlink.go+++ b/kernel/model/backlink.go@@ -656,6 +656,38 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []ret = append(ret, ref)}}++ if 0 < len(keywords) {+ // 过滤场景处理标题下方块 Improve backlink filtering below the heading https://github.com/siyuan-note/siyuan/issues/14929+ headingRefChildren := map[string]*Block{}+ var headingIDs []string+ for _, link := range links {+ for _, ref := range link.Refs {+ if "NodeHeading" == ref.Type {+ headingRefChildren[ref.ID] = ref+ headingIDs = append(headingIDs, ref.ID)+ }+ }+ }+ var headingChildren []*Block+ for _, headingID := range headingIDs {+ sqlChildren := sql.GetChildBlocks(headingID, "", -1)+ children := fromSQLBlocks(&sqlChildren, "", 12)+ headingChildren = append(headingChildren, children...)+ }+ for _, child := range headingChildren {+ if nil == child {+ continue+ }++ if matchBacklinkKeyword(child, keywords) {+ heading := headingRefChildren[child.ParentID]+ if nil != heading {+ ret = append(ret, heading)+ }+ }+ }+ }return}