This commit is contained in:
Daniel 2023-06-09 13:02:21 +08:00
parent eb941b36e4
commit 073af9a310
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
9 changed files with 16 additions and 8 deletions

View file

@ -943,6 +943,7 @@
"task.database.index.fix": "Execute database index fix", "task.database.index.fix": "Execute database index fix",
"task.ocr.image": "Execute image OCR to extract text", "task.ocr.image": "Execute image OCR to extract text",
"task.history.generateDoc": "Execute GenerateDoc History", "task.history.generateDoc": "Execute GenerateDoc History",
"task.history.database.index.full": "Execute history database rebuild index",
"task.history.database.index.commit": "Execute history database index commit", "task.history.database.index.commit": "Execute history database index commit",
"task.database.index.embedBlock": "Execute database index embed block", "task.database.index.embedBlock": "Execute database index embed block",
"task.reload.ui": "Execute reload UI", "task.reload.ui": "Execute reload UI",

View file

@ -943,6 +943,7 @@
"task.database.index.fix": "Ejecutar corrección del índice de la base de datos", "task.database.index.fix": "Ejecutar corrección del índice de la base de datos",
"task.ocr.image": "Ejecutar OCR de imagen para extraer texto", "task.ocr.image": "Ejecutar OCR de imagen para extraer texto",
"task.history.generateDoc": "Ejecutar Historial GenerateDoc", "task.history.generateDoc": "Ejecutar Historial GenerateDoc",
"task.history.database.index.full": "Ejecutar el índice de reconstrucción de la base de datos del historial",
"task.history.database.index.commit": "Ejecutar la confirmación del índice de la base de datos del historial", "task.history.database.index.commit": "Ejecutar la confirmación del índice de la base de datos del historial",
"task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos", "task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos",
"task.reload.ui": "IU de recarga de tareas", "task.reload.ui": "IU de recarga de tareas",

View file

@ -943,6 +943,7 @@
"task.database.index.fix": "Effectuer la correction de l'index de la base de données", "task.database.index.fix": "Effectuer la correction de l'index de la base de données",
"task.ocr.image": "Exécute l'OCR d'image pour extraire le texte", "task.ocr.image": "Exécute l'OCR d'image pour extraire le texte",
"task.history.generateDoc": "Exécuter l'historique de GenerateDoc", "task.history.generateDoc": "Exécuter l'historique de GenerateDoc",
"task.history.database.index.full": "Exécuter l'index de reconstruction de la base de données de l'historique",
"task.history.database.index.commit": "Effectuer la validation de l'index de la base de données d'historique", "task.history.database.index.commit": "Effectuer la validation de l'index de la base de données d'historique",
"task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données", "task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données",
"task.reload.ui": "Interface utilisateur de rechargement de tâche", "task.reload.ui": "Interface utilisateur de rechargement de tâche",

View file

@ -943,6 +943,7 @@
"task.database.index.fix": "執行數據庫索引訂正", "task.database.index.fix": "執行數據庫索引訂正",
"task.ocr.image": "執行圖片 OCR 提取文本", "task.ocr.image": "執行圖片 OCR 提取文本",
"task.history.generateDoc": "執行生成文件歷史", "task.history.generateDoc": "執行生成文件歷史",
"task.history.database.index.full": "執行歷史數據庫重建索引",
"task.history.database.index.commit": "執行歷史數據庫索引提交", "task.history.database.index.commit": "執行歷史數據庫索引提交",
"task.database.index.embedBlock": "執行數據庫索引嵌入塊", "task.database.index.embedBlock": "執行數據庫索引嵌入塊",
"task.reload.ui": "執行重載界面", "task.reload.ui": "執行重載界面",

View file

@ -943,6 +943,7 @@
"task.database.index.fix": "执行数据库索引订正", "task.database.index.fix": "执行数据库索引订正",
"task.ocr.image": "执行图片 OCR 提取文本", "task.ocr.image": "执行图片 OCR 提取文本",
"task.history.generateDoc": "执行生成文件历史", "task.history.generateDoc": "执行生成文件历史",
"task.history.database.index.full": "执行历史数据库重建索引",
"task.history.database.index.commit": "执行历史数据库索引提交", "task.history.database.index.commit": "执行历史数据库索引提交",
"task.database.index.embedBlock": "执行数据库索引嵌入块", "task.database.index.embedBlock": "执行数据库索引嵌入块",
"task.reload.ui": "执行重载界面", "task.reload.ui": "执行重载界面",

View file

@ -96,12 +96,7 @@ func reindexHistory(c *gin.Context) {
ret := gulu.Ret.NewResult() ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret) defer c.JSON(http.StatusOK, ret)
err := model.ReindexHistory() model.ReindexHistory()
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
} }
func getNotebookHistory(c *gin.Context) { func getNotebookHistory(c *gin.Context) {

View file

@ -564,7 +564,12 @@ func getHistoryDir(suffix string, t time.Time) (ret string, err error) {
return return
} }
func ReindexHistory() (err error) { func ReindexHistory() {
task.AppendTask(task.HistoryDatabaseIndexFull, fullReindexHistory)
return
}
func fullReindexHistory() {
historyDirs, err := os.ReadDir(util.HistoryDir) historyDirs, err := os.ReadDir(util.HistoryDir)
if nil != err { if nil != err {
logging.LogErrorf("read history dir [%s] failed: %s", util.HistoryDir, err) logging.LogErrorf("read history dir [%s] failed: %s", util.HistoryDir, err)

View file

@ -83,7 +83,8 @@ func FlushHistoryQueue() {
if err = execHistoryOp(op, tx, context); nil != err { if err = execHistoryOp(op, tx, context); nil != err {
tx.Rollback() tx.Rollback()
logging.LogErrorf("queue operation failed: %s", err) logging.LogErrorf("queue operation failed: %s", err)
continue util.PushMsg("History database index failed, please try to manually rebuild it in [Data history - File history]", 5000)
return
} }
if err = commitHistoryTx(tx); nil != err { if err = commitHistoryTx(tx); nil != err {

View file

@ -90,6 +90,7 @@ const (
DatabaseIndexFix = "task.database.index.fix" // 数据库索引订正 DatabaseIndexFix = "task.database.index.fix" // 数据库索引订正
OCRImage = "task.ocr.image" // 图片 OCR 提取文本 OCRImage = "task.ocr.image" // 图片 OCR 提取文本
HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史 HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史
HistoryDatabaseIndexFull = "task.history.database.index.full" // 历史数据库重建索引
HistoryDatabaseIndexCommit = "task.history.database.index.commit" // 历史数据库索引提交 HistoryDatabaseIndexCommit = "task.history.database.index.commit" // 历史数据库索引提交
DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块 DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
ReloadUI = "task.reload.ui" // 重载 UI ReloadUI = "task.reload.ui" // 重载 UI
@ -103,6 +104,7 @@ var uniqueActions = []string{
DatabaseIndexCommit, DatabaseIndexCommit,
OCRImage, OCRImage,
HistoryGenerateDoc, HistoryGenerateDoc,
HistoryDatabaseIndexFull,
HistoryDatabaseIndexCommit, HistoryDatabaseIndexCommit,
DatabaseIndexEmbedBlock, DatabaseIndexEmbedBlock,
} }