An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Manually optimize the data index to reduce space usage and improve performance https://github.com/siyuan-note/siyuan/issues/15663
Daniel7e6752a8fbbd
diff --git a/kernel/api/router.go b/kernel/api/router.goindex c7a7d37daa..60ef855476 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -67,6 +67,8 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI) // TODO 请使用 /api/ui/reloadUI,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15308#issuecomment-3077675356ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)+ ginServer.Handle("POST", "/api/system/vacuumDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, vacuumDataIndex)+ ginServer.Handle("POST", "/api/system/rebuildDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, rebuildDataIndex)ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorage)ginServer.Handle("POST", "/api/storage/getLocalStorage", model.CheckAuth, getLocalStorage)diff --git a/kernel/api/system.go b/kernel/api/system.goindex 71cade88a0..641bbef754 100644--- a/kernel/api/system.go+++ b/kernel/api/system.go@@ -35,6 +35,20 @@ import ("github.com/siyuan-note/siyuan/kernel/util")+func vacuumDataIndex(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ model.VacuumDataIndex()+}++func rebuildDataIndex(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ model.FullReindex()+}+func addMicrosoftDefenderExclusion(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)diff --git a/kernel/model/box.go b/kernel/model/box.goindex 2ad64abe9f..aae8667e2d 100644--- a/kernel/model/box.go+++ b/kernel/model/box.go@@ -663,6 +663,10 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {return}+func VacuumDataIndex() {++}+func FullReindex() {task.AppendTask(task.DatabaseIndexFull, fullReindex)task.AppendTask(task.DatabaseIndexRef, IndexRefs)