From b274350948c334a9c51472a599d54731ba8bf5be Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 29 Jan 2026 23:45:21 +0800 Subject: [PATCH] :art: Supports cleaning up unreferenced databases https://github.com/siyuan-note/siyuan/issues/11569 Signed-off-by: Daniel <845765@qq.com> --- kernel/model/history.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/model/history.go b/kernel/model/history.go index cdbc21101..37be853fa 100644 --- a/kernel/model/history.go +++ b/kernel/model/history.go @@ -39,6 +39,7 @@ import ( "github.com/siyuan-note/eventbus" "github.com/siyuan-note/filelock" "github.com/siyuan-note/logging" + "github.com/siyuan-note/siyuan/kernel/av" "github.com/siyuan-note/siyuan/kernel/cache" "github.com/siyuan-note/siyuan/kernel/conf" "github.com/siyuan-note/siyuan/kernel/search" @@ -527,7 +528,7 @@ func buildSearchHistoryQueryFilter(query, op, box, table string, typ int) (stmt case HistoryTypeAsset: stmt += table + " MATCH '{title content}:(" + query + ")'" case HistoryTypeDatabase: - stmt += " id = '" + query + "'" + stmt += table + " MATCH '{title}:(" + query + ")'" } } else { stmt += "1=1" @@ -986,11 +987,12 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) { } p := strings.TrimPrefix(database, util.HistoryDir) p = filepath.ToSlash(p[1:]) + avName, _ := av.GetAttributeViewName(id) histories = append(histories, &sql.History{ ID: id, Type: HistoryTypeDatabase, Op: op, - Title: id, + Title: id + avName, Path: p, Created: created, })