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: Improve reindexing
Danielff6c154bfaaf
diff --git a/kernel/model/box.go b/kernel/model/box.goindex a5daf0f291..3b5dec2db6 100644--- a/kernel/model/box.go+++ b/kernel/model/box.go@@ -502,6 +502,7 @@ func genTreeID(tree *parse.Tree) {func FullReindex() {task.AppendTask(task.DatabaseIndexFull, fullReindex)task.AppendTask(task.DatabaseIndexRef, IndexRefs)+ task.AppendTaskWithTimeout(task.DatabaseIndexEmbedBlock, 30*time.Second, autoIndexEmbedBlock)task.AppendTask(task.ReloadUI, util.ReloadUI)}diff --git a/kernel/model/index.go b/kernel/model/index.goindex 78d29376f9..6ac83c750a 100644--- a/kernel/model/index.go+++ b/kernel/model/index.go@@ -282,13 +282,18 @@ func IndexRefs() {ResetVirtualBlockRefCache()}+var indexEmbedBlockLock = sync.Mutex{}+// IndexEmbedBlockJob 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112func IndexEmbedBlockJob() {- embedBlocks := sql.QueryEmptyContentEmbedBlocks()- task.AppendTaskWithTimeout(task.DatabaseIndexEmbedBlock, 30*time.Second, autoIndexEmbedBlock, embedBlocks)+ task.AppendTaskWithTimeout(task.DatabaseIndexEmbedBlock, 30*time.Second, autoIndexEmbedBlock)}-func autoIndexEmbedBlock(embedBlocks []*sql.Block) {+func autoIndexEmbedBlock() {+ indexEmbedBlockLock.Lock()+ defer indexEmbedBlockLock.Unlock()++ embedBlocks := sql.QueryEmptyContentEmbedBlocks()for i, embedBlock := range embedBlocks {markdown := strings.TrimSpace(embedBlock.Markdown)markdown = strings.TrimPrefix(markdown, "{{")