Skip to content

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

:art: Improve ignore indexing

Daniel214840e2f447
diff --git a/kernel/model/box.go b/kernel/model/box.go
index d914060fe6..45c70eae81 100644
--- a/kernel/model/box.go
+++ b/kernel/model/box.go
@@ -513,6 +513,7 @@ func fullReindex() {
}
treenode.InitBlockTree(true)
+ sql.IndexIgnoreCached = false
openedBoxes := Conf.GetOpenedBoxes()
for _, openedBox := range openedBoxes {
index(openedBox.ID)
diff --git a/kernel/sql/upsert.go b/kernel/sql/upsert.go
index 28a93e1a4e..31cbf154a2 100644
--- a/kernel/sql/upsert.go
+++ b/kernel/sql/upsert.go
@@ -26,7 +26,6 @@ import (
"path/filepath"
"strings"
"sync"
- "time"
"github.com/88250/gulu"
"github.com/88250/lute/parse"
@@ -511,24 +510,22 @@ func insertTree0(tx *sql.Tx, tree *parse.Tree, context map[string]interface{},
}
var (
- indexIgnoreLastModified int64
- indexIgnore []string
- indexIgnoreLock = sync.Mutex{}
+ IndexIgnoreCached bool
+ indexIgnore []string
+ indexIgnoreLock = sync.Mutex{}
)
func getIndexIgnoreLines() (ret []string) {
// Support ignore index https://github.com/siyuan-note/siyuan/issues/9198
- now := time.Now().UnixMilli()
- if now-indexIgnoreLastModified < 30*1000 {
+ if IndexIgnoreCached {
return indexIgnore
}
indexIgnoreLock.Lock()
defer indexIgnoreLock.Unlock()
- indexIgnoreLastModified = now
-
+ IndexIgnoreCached = true
indexIgnorePath := filepath.Join(util.DataDir, ".siyuan", "indexignore")
err := os.MkdirAll(filepath.Dir(indexIgnorePath), 0755)
if nil != err {