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