🐛 Renaming doc title does not update title in ial https://github.com/siyuan-note/siyuan/issues/16166

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-10-21 17:52:42 +08:00
parent b91f2cb3ad
commit 73963739ce
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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
}
}