An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: Optimize document moving and renaming performance https://github.com/siyuan-note/siyuan/issues/10560
Daniel9bc6415c6a64
diff --git a/kernel/sql/database.go b/kernel/sql/database.goindex 0ffd7cf9b1..d622ee243c 100644--- a/kernel/sql/database.go+++ b/kernel/sql/database.go@@ -1211,18 +1211,18 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) {return}-func batchUpdateHPath(tx *sql.Tx, boxID, rootID, newHPath string, context map[string]interface{}) (err error) {- stmt := "UPDATE blocks SET hpath = ? WHERE box = ? AND root_id = ?"- if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {+func batchUpdateHPath(tx *sql.Tx, rootID, newHPath string, context map[string]interface{}) (err error) {+ stmt := "UPDATE blocks SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, newHPath, rootID); nil != err {return}- stmt = "UPDATE blocks_fts SET hpath = ? WHERE box = ? AND root_id = ?"- if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {+ stmt = "UPDATE blocks_fts SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, newHPath, rootID); nil != err {return}if !caseSensitive {- stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE box = ? AND root_id = ?"- if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {+ stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, newHPath, rootID); nil != err {return}}diff --git a/kernel/sql/queue.go b/kernel/sql/queue.goindex 3a538a8976..ad22870df3 100644--- a/kernel/sql/queue.go+++ b/kernel/sql/queue.go@@ -174,13 +174,13 @@ func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]interface{}) (ecase "delete_ids":err = batchDeleteByRootIDs(tx, op.removeTreeIDs, context)case "rename":- err = batchUpdateHPath(tx, op.renameTree.Box, op.renameTree.ID, op.renameTree.HPath, context)+ err = batchUpdateHPath(tx, op.renameTree.ID, op.renameTree.HPath, context)if nil != err {break}err = updateRootContent(tx, path.Base(op.renameTree.HPath), op.renameTree.Root.IALAttr("updated"), op.renameTree.ID)case "rename_sub_tree":- err = batchUpdateHPath(tx, op.renameTree.Box, op.renameTree.ID, op.renameTree.HPath, context)+ err = batchUpdateHPath(tx, op.renameTree.ID, op.renameTree.HPath, context)case "delete_box":err = deleteByBoxTx(tx, op.box)case "delete_box_refs":