From 73963739ceee1b908ab505d96d88a97b72d8f976 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 21 Oct 2025 17:52:42 +0800 Subject: [PATCH] :bug: Renaming doc title does not update `title` in ial https://github.com/siyuan-note/siyuan/issues/16166 Signed-off-by: Daniel <845765@qq.com> --- kernel/sql/database.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/kernel/sql/database.go b/kernel/sql/database.go index e79dd8950..8068cff1f 100644 --- a/kernel/sql/database.go +++ b/kernel/sql/database.go @@ -1256,17 +1256,18 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) { } func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) { - stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil { + ialContent := treenode.IALStr(tree.Root) + stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil { return } - stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil { + stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil { return } if !caseSensitive { - stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil { + stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil { return } } @@ -1277,17 +1278,18 @@ func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{ } func batchUpdateHPath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) { - stmt := "UPDATE blocks SET hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil { + ialContent := treenode.IALStr(tree.Root) + stmt := "UPDATE blocks SET hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil { return } - stmt = "UPDATE blocks_fts SET hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil { + stmt = "UPDATE blocks_fts SET hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil { return } if !caseSensitive { - stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE root_id = ?" - if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil { + stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ?, ial = ? WHERE root_id = ?" + if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil { return } }