Skip to content

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

:art: Backlink count at the doc block title including sub-blocks https://github.com/siyuan-note/siyuan/issues/13791

Daniel1a991bf20fe8
diff --git a/kernel/api/block.go b/kernel/api/block.go
index 56ac83c209..70c87c13ba 100644
--- a/kernel/api/block.go
+++ b/kernel/api/block.go
@@ -455,10 +455,9 @@ func getRefIDsByFileAnnotationID(c *gin.Context) {
}
id := arg["id"].(string)
- refIDs, refTexts := model.GetBlockRefIDsByFileAnnotationID(id)
+ refIDs := model.GetBlockRefIDsByFileAnnotationID(id)
ret.Data = map[string][]string{
- "refIDs": refIDs,
- "refTexts": refTexts,
+ "refIDs": refIDs,
}
}
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index 4f92a7eb53..a6b987fa01 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -369,9 +369,8 @@ func queryDocRefDefs(rootID string) (refDefs []*RefDefs) {
return
}
-func GetBlockRefIDsByFileAnnotationID(id string) (refIDs, refTexts []string) {
- refIDs, refTexts = sql.QueryRefIDsByAnnotationID(id)
- return
+func GetBlockRefIDsByFileAnnotationID(id string) []string {
+ return sql.QueryRefIDsByAnnotationID(id)
}
func GetBlockDefIDsByRefText(refText string, excludeIDs []string) (ret []string) {
diff --git a/kernel/sql/file_annotation_ref.go b/kernel/sql/file_annotation_ref.go
index 8c1df83751..f1c2da1369 100644
--- a/kernel/sql/file_annotation_ref.go
+++ b/kernel/sql/file_annotation_ref.go
@@ -32,22 +32,21 @@ type FileAnnotationRef struct {
Type string
}
-func QueryRefIDsByAnnotationID(annotationID string) (refIDs, refTexts []string) {
+func QueryRefIDsByAnnotationID(annotationID string) (refIDs []string) {
refIDs = []string{}
- rows, err := query("SELECT block_id, content FROM file_annotation_refs WHERE annotation_id = ?", annotationID)
+ rows, err := query("SELECT block_id FROM file_annotation_refs WHERE annotation_id = ?", annotationID)
if err != nil {
logging.LogErrorf("sql query failed: %s", err)
return
}
defer rows.Close()
for rows.Next() {
- var id, content string
- if err = rows.Scan(&id, &content); err != nil {
+ var id string
+ if err = rows.Scan(&id); err != nil {
logging.LogErrorf("query scan field failed: %s", err)
return
}
refIDs = append(refIDs, id)
- refTexts = append(refTexts, content)
}
return
}