🎨 Supports cleaning up unreferenced databases https://github.com/siyuan-note/siyuan/issues/11569

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-30 00:03:29 +08:00
parent ea178b40f3
commit a2a3bca000
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 40 additions and 38 deletions

View file

@ -528,7 +528,7 @@ func buildSearchHistoryQueryFilter(query, op, box, table string, typ int) (stmt
case HistoryTypeAsset:
stmt += table + " MATCH '{title content}:(" + query + ")'"
case HistoryTypeDatabase:
stmt += table + " MATCH '{title}:(" + query + ")'"
stmt += table + " MATCH '{content}:(" + query + ")'"
}
} else {
stmt += "1=1"
@ -987,12 +987,13 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) {
}
p := strings.TrimPrefix(database, util.HistoryDir)
p = filepath.ToSlash(p[1:])
avName, _ := av.GetAttributeViewNameByPath(database)
content := av.GetAttributeViewContent(id)
histories = append(histories, &sql.History{
ID: id,
Type: HistoryTypeDatabase,
Op: op,
Title: id + avName,
Title: id,
Content: content,
Path: p,
Created: created,
})