mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Automatically check and eliminate duplicate reference relationships Fix https://github.com/siyuan-note/siyuan/issues/9618
This commit is contained in:
parent
62e27ba24c
commit
368091bd53
3 changed files with 50 additions and 10 deletions
|
|
@ -28,6 +28,21 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/search"
|
||||
)
|
||||
|
||||
func GetRefDuplicatedDefRootIDs() (ret []string) {
|
||||
rows, err := query("SELECT DISTINCT def_block_root_id FROM `refs` GROUP BY def_block_id, def_block_root_id HAVING COUNT(*) > 1 LIMIT 1")
|
||||
if nil != err {
|
||||
logging.LogErrorf("sql query failed: %s", err)
|
||||
return
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var id string
|
||||
rows.Scan(&id)
|
||||
ret = append(ret, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryVirtualRefKeywords(name, alias, anchor, doc bool) (ret []string) {
|
||||
if name {
|
||||
ret = append(ret, queryNames()...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue