Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve data indexing

Daniel444f87391913
diff --git a/kernel/sql/database.go b/kernel/sql/database.go
index e29d2e6336..15db0723eb 100644
--- a/kernel/sql/database.go
+++ b/kernel/sql/database.go
@@ -959,6 +959,10 @@ func deleteByBoxTx(tx *sql.Tx, box string) (err error) {
}
func deleteBlocksByIDs(tx *sql.Tx, ids []string) (err error) {
+ if 1 > len(ids) {
+ return
+ }
+
var ftsIDs []string
for _, id := range ids {
removeBlockCache(id)
@@ -1136,6 +1140,10 @@ func deleteByRootID(tx *sql.Tx, rootID string, context map[string]interface{}) (
}
func batchDeleteByRootIDs(tx *sql.Tx, rootIDs []string, context map[string]interface{}) (err error) {
+ if 1 > len(rootIDs) {
+ return
+ }
+
ids := strings.Join(rootIDs, "','")
ids = "('" + ids + "')"
stmt := "DELETE FROM blocks WHERE root_id IN " + ids