🎨 Improve ocr text indexing
* 调用 setImageOCRText 后重建资源索引 * 优化性能
This commit is contained in:
parent
d9fd9f68d2
commit
0309e1772e
1 changed files with 9 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue