♻️ 重命名重建索引函数

This commit is contained in:
Liang Ding 2022-09-16 19:45:46 +08:00
parent e2e929538b
commit 67ff76c605
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 11 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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