Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Revert Improve backlink filtering below the heading Improve backlink filtering below the heading

Daniel84e9a003e8d1
diff --git a/kernel/model/backlink.go b/kernel/model/backlink.go
index 5cff17ead0..ea25433038 100644
--- a/kernel/model/backlink.go
+++ b/kernel/model/backlink.go
@@ -476,7 +476,7 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChild
var paragraphParentIDs []string
for _, link := range links {
for _, ref := range link.Refs {
- if "NodeParagraph" == ref.Type || "NodeHeading" == ref.Type {
+ if "NodeParagraph" == ref.Type {
paragraphParentIDs = append(paragraphParentIDs, ref.ParentID)
}
}
@@ -494,7 +494,7 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChild
}
for _, link := range links {
for _, ref := range link.Refs {
- if "NodeParagraph" == ref.Type || "NodeHeading" == ref.Type {
+ if "NodeParagraph" == ref.Type {
if processedParagraphs.Contains(ref.ParentID) {
continue
}
@@ -580,7 +580,7 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
var paragraphParentIDs []string
for _, link := range links {
for _, ref := range link.Refs {
- if "NodeParagraph" == ref.Type || "NodeHeading" == ref.Type {
+ if "NodeParagraph" == ref.Type {
parentRefParagraphs[ref.ParentID] = ref
paragraphParentIDs = append(paragraphParentIDs, ref.ParentID)
}
@@ -615,15 +615,7 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
continue
}
- text := c.Text()
- if strings.HasPrefix(text, "#") {
- tmp := strings.ReplaceAll(text, "#", "")
- if " " == tmp { // 如果是标题标记符则跳过
- continue
- }
- }
-
- if "" != strings.TrimSpace(text) {
+ if "" != strings.TrimSpace(c.Text()) {
paragraphUseParentLi = false
break
}
@@ -648,7 +640,7 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
}
for _, link := range links {
for _, ref := range link.Refs {
- if "NodeParagraph" == ref.Type || "NodeHeading" == ref.Type {
+ if "NodeParagraph" == ref.Type {
if processedParagraphs.Contains(ref.ParentID) {
continue
}