Skip to content

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

:art: Perform indexing in the background when moving a large number of documents Fix https://github.com/siyuan-note/siyuan/issues/9356

Daniel125b180029dc
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 1be997f731..6b365caaf9 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1124,14 +1124,21 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
}
}
+ // A progress layer appears when moving more than 16 documents at once https://github.com/siyuan-note/siyuan/issues/9356
needShowProgress := 16 < len(fromPaths)
if needShowProgress {
- util.PushEndlessProgress(Conf.Language(116))
+ defer util.PushClearProgress()
}
WaitForWritingFiles()
luteEngine := util.NewLute()
+ count := 0
for fromPath, fromBox := range pathsBoxes {
+ count++
+ if needShowProgress {
+ util.PushEndlessProgress(fmt.Sprintf(Conf.Language(70), fmt.Sprintf("%d/%d", count, len(fromPaths))))
+ }
+
_, err = moveDoc(fromBox, fromPath, toBox, toPath, luteEngine, callback)
if nil != err {
return
@@ -1139,12 +1146,6 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
}
cache.ClearDocsIAL()
IncSync()
-
- if needShowProgress {
- util.PushEndlessProgress(Conf.Language(113))
- sql.WaitForWritingDatabase()
- util.ReloadUI()
- }
return
}