瀏覽代碼

:art: 重建索引时补全文档树缺失的 updated 字段

Liang Ding 2 年之前
父節點
當前提交
559a063c63
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      kernel/model/index.go

+ 7 - 0
kernel/model/index.go

@@ -78,6 +78,13 @@ func (box *Box) Index(fullRebuildIndex bool) (treeCount int, treeSize int64) {
 		}
 		}
 
 
 		docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL)
 		docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL)
+		if "" == docIAL["updated"] {
+			updated := util.TimeFromID(tree.Root.ID)
+			tree.Root.SetIALAttr("updated", updated)
+			docIAL["updated"] = updated
+			writeJSONQueue(tree)
+		}
+
 		cache.PutDocIAL(p, docIAL)
 		cache.PutDocIAL(p, docIAL)
 
 
 		util.IncBootProgress(bootProgressPart, fmt.Sprintf(Conf.Language(92), util.ShortPathForBootingDisplay(tree.Path)))
 		util.IncBootProgress(bootProgressPart, fmt.Sprintf(Conf.Language(92), util.ShortPathForBootingDisplay(tree.Path)))