mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🎨 Improve ocr text indexing
* 调用 setImageOCRText 后重建资源索引 * 优化性能
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
@@ -128,6 +129,14 @@ func setImageOCRText(c *gin.Context) {
|
||||
path := arg["path"].(string)
|
||||
text := arg["text"].(string)
|
||||
util.SetAssetText(path, text)
|
||||
|
||||
// 刷新 OCR 结果到数据库
|
||||
util.NodeOCRQueueLock.Lock()
|
||||
defer util.NodeOCRQueueLock.Unlock()
|
||||
for _, id := range util.NodeOCRQueue {
|
||||
sql.IndexNodeQueue(id)
|
||||
}
|
||||
util.NodeOCRQueue = nil
|
||||
}
|
||||
|
||||
func ocr(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user