Quellcode durchsuchen

:recycle: 重命名重建索引函数

Liang Ding vor 2 Jahren
Ursprung
Commit
67ff76c605

+ 1 - 1
kernel/api/filetree.go

@@ -55,7 +55,7 @@ func refreshFiletree(c *gin.Context) {
 	ret := gulu.Ret.NewResult()
 	defer c.JSON(http.StatusOK, ret)
 
-	model.RefreshFileTree()
+	model.FullReindex()
 }
 
 func doc2Heading(c *gin.Context) {

+ 1 - 1
kernel/api/setting.go

@@ -213,7 +213,7 @@ func setSearch(c *gin.Context) {
 	model.Conf.Save()
 	sql.SetCaseSensitive(s.CaseSensitive)
 	if s.CaseSensitive != oldCaseSensitive {
-		model.RefreshFileTree()
+		model.FullReindex()
 	}
 	sql.ClearVirtualRefKeywords()
 	ret.Data = s

+ 2 - 2
kernel/model/box.go

@@ -483,10 +483,10 @@ func ReindexTree(path string) (err error) {
 	return
 }
 
-func RefreshFileTree() {
+func FullReindex() {
+	util.PushEndlessProgress(Conf.Language(35))
 	WaitForWritingFiles()
 
-	util.PushEndlessProgress(Conf.Language(35))
 	if err := sql.InitDatabase(true); nil != err {
 		util.PushErrMsg(fmt.Sprintf(Conf.Language(85), err), 5000)
 		return

+ 2 - 2
kernel/model/history.go

@@ -266,7 +266,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
 	}
 	writingDataLock.Unlock()
 
-	RefreshFileTree()
+	FullReindex()
 	IncSync()
 	return nil
 }
@@ -321,7 +321,7 @@ func RollbackNotebookHistory(historyPath string) (err error) {
 		return
 	}
 
-	RefreshFileTree()
+	FullReindex()
 	IncSync()
 	return nil
 }

+ 3 - 3
kernel/model/import.go

@@ -296,7 +296,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
 	}
 
 	IncSync()
-	RefreshFileTree()
+	FullReindex()
 	return
 }
 
@@ -343,7 +343,7 @@ func ImportData(zipPath string) (err error) {
 	}
 
 	IncSync()
-	RefreshFileTree()
+	FullReindex()
 	return
 }
 
@@ -518,7 +518,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
 		}
 
 		IncSync()
-		RefreshFileTree()
+		FullReindex()
 	} else { // 导入单个文件
 		fileName := filepath.Base(localPath)
 		if !strings.HasSuffix(fileName, ".md") && !strings.HasSuffix(fileName, ".markdown") {

+ 2 - 2
kernel/model/repository.go

@@ -240,7 +240,7 @@ func CheckoutRepo(id string) (err error) {
 		return
 	}
 
-	RefreshFileTree()
+	FullReindex()
 	if syncEnabled {
 		func() {
 			time.Sleep(5 * time.Second)
@@ -616,7 +616,7 @@ func syncRepo(boot, exit, byHand bool) (err error) {
 	cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
 
 	if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
-		RefreshFileTree()
+		FullReindex()
 		return
 	}
 	incReindex(upserts, removes)