Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
9e52b489a7
16 changed files with 93 additions and 79 deletions
|
@ -873,7 +873,8 @@
|
|||
"task.database.index.fix": "Execute database index fix",
|
||||
"task.ocr.image": "Execute image OCR to extract text",
|
||||
"task.history.generateDoc": "Execute GenerateDoc History",
|
||||
"task.database.index.embedBlock": "Execute database index embed block"
|
||||
"task.database.index.embedBlock": "Execute database index embed block",
|
||||
"task.reload.ui": "Execute reload UI"
|
||||
},
|
||||
"_trayMenu": {
|
||||
"showWindow": "Show Window",
|
||||
|
@ -944,7 +945,7 @@
|
|||
"55": "Indexed references of [%d] documents",
|
||||
"56": "Reindexing, please wait until rebuilding is complete before trying to open",
|
||||
"57": "Failed to create temp key",
|
||||
"58": "After the index is rebuilt, the interface will be automatically refreshed later...",
|
||||
"58": "TODO",
|
||||
"59": "Failed to set sync ignore list",
|
||||
"60": "Failed to get the update package: %s",
|
||||
"61": "⬆️ The new version installation package is ready, do you want to install the new version now?",
|
||||
|
@ -975,8 +976,8 @@
|
|||
"86": "Please configure [Settings - About - Access authorization code]",
|
||||
"87": "Cannot move to this location",
|
||||
"88": "Finished parsing [%d] data files, remaining to be processed [%d]",
|
||||
"89": "Created [%d] of data indexes of block-level elements [%s]",
|
||||
"90": "Created [%d] of search indexes of block-level elements [%s]",
|
||||
"89": "[%d/%d] Created [%d] of data indexes of block-level elements [%s]",
|
||||
"90": "[%d/%d] Created [%d] of search indexes of block-level elements [%s]",
|
||||
"91": "Reading block tree data...",
|
||||
"92": "Parsing document tree [%s]",
|
||||
"93": "TODO",
|
||||
|
|
|
@ -873,7 +873,8 @@
|
|||
"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.history.generateDoc": "Ejecutar Historial GenerateDoc",
|
||||
"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"
|
||||
},
|
||||
"_trayMenu": {
|
||||
"showWindow": "Mostrar ventana",
|
||||
|
@ -944,7 +945,7 @@
|
|||
"55": "Referencias indexadas de [%d] documentos",
|
||||
"56": "Reindexando, espere hasta que se complete la reconstrucción antes de intentar abrir",
|
||||
"57": "Fallo en la creación de la clave temporal",
|
||||
"58": "Después de reconstruir el índice, la interfaz se actualizará automáticamente más tarde...",
|
||||
"58": "TODO",
|
||||
"59": " Falló la configuración de sincronización de la lista de ignorados",
|
||||
"60": "Fallo al obtener el paquete de actualización: %s",
|
||||
"61": "⬆️ El paquete de instalación de la nueva versión está listo, ¿quieres instalar la nueva versión ahora?",
|
||||
|
@ -975,8 +976,8 @@
|
|||
"86": "Por favor, configure [Configuración - Acerca de - Código de autorización de acceso]",
|
||||
"87": "No se puede mover a esta ubicación",
|
||||
"88": "Se ha terminado de analizar [%d] archivos de datos, quedan por procesar [%d]",
|
||||
"89": "Creado [%d] de índices de datos de elementos a nivel de bloque [%s]",
|
||||
"90": "Creado [%d] de índices de búsqueda de elementos a nivel de bloque [%s]",
|
||||
"89": "[%d/%d] Creado [%d] de índices de datos de elementos a nivel de bloque [%s]",
|
||||
"90": "[%d/%d] Creado [%d] de índices de búsqueda de elementos a nivel de bloque [%s]",
|
||||
"91": "Leyendo datos del árbol de bloques...",
|
||||
"92": "Analizando el árbol del documento [%s]",
|
||||
"93": "TODO",
|
||||
|
|
|
@ -873,7 +873,8 @@
|
|||
"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.history.generateDoc": "Exécuter l'historique de GenerateDoc",
|
||||
"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"
|
||||
},
|
||||
"_trayMenu": {
|
||||
"showWindow": "Afficher la fenêtre principale",
|
||||
|
@ -944,7 +945,7 @@
|
|||
"55": "Références indexées de [%d] documents",
|
||||
"56": "Réindexation, veuillez attendre que la reconstruction soit terminée avant d'essayer d'ouvrir",
|
||||
"57": "Échec de la création d'une clé temporaire",
|
||||
"58": "Une fois l'index reconstruit, l'interface sera automatiquement rafraîchie ultérieurement...",
|
||||
"58": "TODO",
|
||||
"59": "Échec de la définition de la liste des ignores de synchronisation",
|
||||
"60": "Échec de la récupération du paquet de mise à jour : %s",
|
||||
"61": "⬆️ Le package d'installation de la nouvelle version est prêt, voulez-vous installer la nouvelle version maintenant ?",
|
||||
|
@ -975,8 +976,8 @@
|
|||
"86": "Veuillez configurer [Paramètres - A propos de - Code d'autorisation d'accès]",
|
||||
"87": "Impossible de se déplacer vers cet endroit",
|
||||
"88": "Fin de l'analyse des fichiers de données [%d], restant à traiter [%d]",
|
||||
"89": "Créé [%d] d'index de données d'éléments de niveau bloc [%s]",
|
||||
"90": "Création de [%d] index de recherche d'éléments de niveau bloc [%s]",
|
||||
"89": "[%d/%d] Créé [%d] d'index de données d'éléments de niveau bloc [%s]",
|
||||
"90": "[%d/%d] Création de [%d] index de recherche d'éléments de niveau bloc [%s]",
|
||||
"91": "Lecture des données de l'arborescence des blocs...",
|
||||
"92": "Analyse de l'arborescence du document [%s]",
|
||||
"93": "TODO",
|
||||
|
|
|
@ -873,7 +873,8 @@
|
|||
"task.database.index.fix": "執行數據庫索引訂正",
|
||||
"task.ocr.image": "執行圖片 OCR 提取文本",
|
||||
"task.history.generateDoc": "執行生成文件歷史",
|
||||
"task.database.index.embedBlock": "執行數據庫索引嵌入塊"
|
||||
"task.database.index.embedBlock": "執行數據庫索引嵌入塊",
|
||||
"task.reload.ui": "執行重載界面"
|
||||
},
|
||||
"_trayMenu": {
|
||||
"showWindow": "顯示主窗口",
|
||||
|
@ -944,7 +945,7 @@
|
|||
"55": "已完成索引 [%d] 篇文檔的引用關係",
|
||||
"56": "正在重建索引,請等重建索引完畢後再嘗試打開",
|
||||
"57": "創建臨時金鑰失敗",
|
||||
"58": "重建索引完畢,稍後將自動重新整理介面...",
|
||||
"58": "TODO",
|
||||
"59": "設置同步忽略列表失敗",
|
||||
"60": "獲取更新包失敗:%s",
|
||||
"61": "⬆️ 新版本安裝包已經準備就緒,是否現在安裝新版本?",
|
||||
|
@ -975,8 +976,8 @@
|
|||
"86": "請先配置 [設置 - 關於 - 存取授權碼]",
|
||||
"87": "無法移動到該位置",
|
||||
"88": "已完成解析 [%d] 個數據文件,剩餘待處理 [%d]",
|
||||
"89": "已經建立 [%d] 個塊級元素的數據索引 [%s]",
|
||||
"90": "已經建立 [%d] 個塊級元素的搜索索引 [%s]",
|
||||
"89": "[%d/%d] 已經建立 [%d] 個塊級元素的數據索引 [%s]",
|
||||
"90": "[%d/%d] 已經建立 [%d] 個塊級元素的搜索索引 [%s]",
|
||||
"91": "正在讀取塊樹數據...",
|
||||
"92": "正在解析文檔樹 [%s]",
|
||||
"93": "TODO",
|
||||
|
|
|
@ -873,7 +873,8 @@
|
|||
"task.database.index.fix": "执行数据库索引订正",
|
||||
"task.ocr.image": "执行图片 OCR 提取文本",
|
||||
"task.history.generateDoc": "执行生成文件历史",
|
||||
"task.database.index.embedBlock": "执行数据库索引嵌入块"
|
||||
"task.database.index.embedBlock": "执行数据库索引嵌入块",
|
||||
"task.reload.ui": "执行重载界面"
|
||||
},
|
||||
"_trayMenu": {
|
||||
"showWindow": "显示主窗口",
|
||||
|
@ -944,7 +945,7 @@
|
|||
"55": "已完成索引 [%d] 篇文档的引用关系",
|
||||
"56": "正在重建索引,请等重建索引完毕后再尝试打开",
|
||||
"57": "创建临时密钥失败",
|
||||
"58": "重建索引完毕,稍后将自动刷新界面...",
|
||||
"58": "TODO",
|
||||
"59": "设置同步忽略列表失败",
|
||||
"60": "获取更新包失败:%s",
|
||||
"61": "⬆️ 新版本安装包已经准备就绪,是否现在安装新版本?",
|
||||
|
@ -975,8 +976,8 @@
|
|||
"86": "请先配置 [设置 - 关于 - 访问授权码]",
|
||||
"87": "无法移动到该位置",
|
||||
"88": "已完成解析 [%d] 个数据文件,剩余待处理 [%d]",
|
||||
"89": "已经建立 [%d] 个块级元素的数据索引 [%s]",
|
||||
"90": "已经建立 [%d] 个块级元素的搜索索引 [%s]",
|
||||
"89": "[%d/%d] 已经建立 [%d] 个块级元素的数据索引 [%s]",
|
||||
"90": "[%d/%d] 已经建立 [%d] 个块级元素的搜索索引 [%s]",
|
||||
"91": "正在读取块树数据...",
|
||||
"92": "正在解析文档树 [%s]",
|
||||
"93": "TODO",
|
||||
|
|
|
@ -497,13 +497,17 @@ func genTreeID(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
|
||||
func ReloadUI() {
|
||||
task.AppendTask(task.ReloadUI, util.ReloadUI)
|
||||
}
|
||||
|
||||
func FullReindex() {
|
||||
task.PrependTask(task.DatabaseIndexFull, fullReindex)
|
||||
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
|
||||
}
|
||||
|
||||
func fullReindex() {
|
||||
util.PushMsg(Conf.Language(35), 60*1000*10)
|
||||
util.PushMsg(Conf.Language(35), 7*1000)
|
||||
WaitForWritingFiles()
|
||||
|
||||
if err := sql.InitDatabase(true); nil != err {
|
||||
|
@ -518,12 +522,6 @@ func fullReindex() {
|
|||
}
|
||||
treenode.SaveBlockTree(true)
|
||||
LoadFlashcards()
|
||||
|
||||
util.PushMsg(Conf.Language(58), 7000)
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
util.ReloadUI()
|
||||
}()
|
||||
}
|
||||
|
||||
func ChangeBoxSort(boxIDs []string) {
|
||||
|
|
|
@ -243,6 +243,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
ReloadUI()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -298,6 +299,7 @@ func RollbackNotebookHistory(historyPath string) (err error) {
|
|||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
ReloadUI()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -441,6 +441,7 @@ func ImportData(zipPath string) (err error) {
|
|||
|
||||
IncSync()
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -706,13 +707,6 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||
return
|
||||
}
|
||||
IncSync()
|
||||
sql.WaitForWritingDatabase()
|
||||
|
||||
util.PushEndlessProgress(Conf.Language(58))
|
||||
go func() {
|
||||
time.Sleep(2 * time.Second)
|
||||
util.ReloadUI()
|
||||
}()
|
||||
}
|
||||
debug.FreeOSMemory()
|
||||
IncSync()
|
||||
|
|
|
@ -187,23 +187,25 @@ func IndexRefs() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, blockCount int, hash string) {
|
||||
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
|
||||
// Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
|
||||
return
|
||||
}
|
||||
|
||||
msg := fmt.Sprintf(Conf.Language(89), blockCount, hash)
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
//eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, current, total, blockCount int, hash string) {
|
||||
// if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
|
||||
// // Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// msg := fmt.Sprintf(Conf.Language(89), current, total, blockCount, hash)
|
||||
// util.SetBootDetails(msg)
|
||||
// util.ContextPushMsg(context, msg)
|
||||
//})
|
||||
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
|
||||
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
|
||||
// Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
|
||||
return
|
||||
}
|
||||
|
||||
msg := fmt.Sprintf(Conf.Language(90), blockCount, hash)
|
||||
current := context["current"].(int) + 1
|
||||
total := context["total"]
|
||||
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash)
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
|
|
|
@ -540,6 +540,7 @@ func checkoutRepo(id string) {
|
|||
}
|
||||
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
|
||||
if syncEnabled {
|
||||
func() {
|
||||
|
@ -1025,12 +1026,15 @@ func syncRepo(exit, byHand bool) (err error) {
|
|||
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
|
||||
if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
|
||||
FullReindex()
|
||||
if !exit {
|
||||
ReloadUI()
|
||||
}
|
||||
return
|
||||
}
|
||||
incReindex(upserts, removes)
|
||||
|
||||
incReindex(upserts, removes)
|
||||
if !exit {
|
||||
util.ReloadUI()
|
||||
ReloadUI()
|
||||
}
|
||||
|
||||
elapsed = time.Since(start)
|
||||
|
|
|
@ -251,11 +251,6 @@ func incReindex(upserts, removes []string) {
|
|||
treenode.IndexBlockTree(tree)
|
||||
sql.UpsertTreeQueue(tree)
|
||||
}
|
||||
|
||||
util.PushStatusBar(Conf.Language(58))
|
||||
if needPushRemoveProgress || needPushUpsertProgress {
|
||||
util.PushEndlessProgress(Conf.Language(58))
|
||||
}
|
||||
}
|
||||
|
||||
func SetCloudSyncDir(name string) {
|
||||
|
|
|
@ -310,6 +310,11 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
|
|||
targetNode = targetChildren[l-1]
|
||||
}
|
||||
}
|
||||
|
||||
if isMovingFoldHeadingIntoSelf(targetNode, headingChildren) {
|
||||
return
|
||||
}
|
||||
|
||||
for i := len(headingChildren) - 1; -1 < i; i-- {
|
||||
c := headingChildren[i]
|
||||
targetNode.InsertAfter(c)
|
||||
|
@ -352,6 +357,10 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeBlockNotFound, id: targetParentID}
|
||||
}
|
||||
|
||||
if isMovingFoldHeadingIntoSelf(targetNode, headingChildren) {
|
||||
return
|
||||
}
|
||||
|
||||
processed := false
|
||||
if ast.NodeSuperBlock == targetNode.Type {
|
||||
// 在布局节点后插入
|
||||
|
@ -406,6 +415,16 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
|
|||
return
|
||||
}
|
||||
|
||||
func isMovingFoldHeadingIntoSelf(targetNode *ast.Node, headingChildren []*ast.Node) bool {
|
||||
for _, headingChild := range headingChildren {
|
||||
if headingChild.ID == targetNode.ID {
|
||||
// 不能将折叠标题移动到自己下方节点的前或后 https://github.com/siyuan-note/siyuan/issues/7163
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (tx *Transaction) doPrependInsert(operation *Operation) (ret *TxErr) {
|
||||
var err error
|
||||
block := treenode.GetBlockTree(operation.ParentID)
|
||||
|
|
|
@ -180,9 +180,10 @@ func initHistoryDBConnection() {
|
|||
|
||||
dsn := util.HistoryDBPath + "?_journal_mode=OFF" +
|
||||
"&_synchronous=OFF" +
|
||||
"&_mmap_size=2684354560" +
|
||||
"&_secure_delete=OFF" +
|
||||
"&_cache_size=-20480" +
|
||||
"&_page_size=8192" +
|
||||
"&_page_size=32768" +
|
||||
"&_busy_timeout=7000" +
|
||||
"&_ignore_check_constraints=ON" +
|
||||
"&_temp_store=MEMORY" +
|
||||
|
@ -212,9 +213,10 @@ func initDBConnection() {
|
|||
}
|
||||
dsn := util.DBPath + "?_journal_mode=WAL" +
|
||||
"&_synchronous=OFF" +
|
||||
"&_mmap_size=2684354560" +
|
||||
"&_secure_delete=OFF" +
|
||||
"&_cache_size=-20480" +
|
||||
"&_page_size=8192" +
|
||||
"&_page_size=32768" +
|
||||
"&_busy_timeout=7000" +
|
||||
"&_ignore_check_constraints=ON" +
|
||||
"&_temp_store=MEMORY" +
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -101,45 +102,36 @@ func FlushQueue() {
|
|||
txLock.Lock()
|
||||
defer txLock.Unlock()
|
||||
start := time.Now()
|
||||
tx, err := beginTx()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
var execOps int
|
||||
context := map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar}
|
||||
total := len(ops)
|
||||
for i, op := range ops {
|
||||
if util.IsExiting {
|
||||
return
|
||||
}
|
||||
|
||||
err = execOp(op, tx, context)
|
||||
execOps++
|
||||
|
||||
tx, err := beginTx()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
context["current"] = i
|
||||
context["total"] = total
|
||||
if err = execOp(op, tx, context); nil != err {
|
||||
logging.LogErrorf("queue operation failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
if 0 < i && 0 == execOps%128 {
|
||||
if err = commitTx(tx); nil != err {
|
||||
logging.LogErrorf("commit tx failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
execOps = 0
|
||||
tx, err = beginTx()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if 0 < execOps {
|
||||
if err = commitTx(tx); nil != err {
|
||||
logging.LogErrorf("commit tx failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
if 16 < i && 0 == i%256 {
|
||||
runtime.GC()
|
||||
}
|
||||
}
|
||||
|
||||
elapsed := time.Now().Sub(start).Milliseconds()
|
||||
if 5000 < elapsed {
|
||||
logging.LogInfof("op tx [%dms]", elapsed)
|
||||
|
@ -171,7 +163,7 @@ func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]interface{}) (e
|
|||
case "update_refs":
|
||||
err = upsertRefs(tx, op.upsertTree)
|
||||
default:
|
||||
msg := fmt.Sprint("unknown operation [%s]", op.action)
|
||||
msg := fmt.Sprintf("unknown operation [%s]", op.action)
|
||||
logging.LogErrorf(msg)
|
||||
err = errors.New(msg)
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ func insertBlocks0(tx *sql.Tx, bulk []*Block, context map[string]interface{}) (e
|
|||
}
|
||||
hashBuf.WriteString("blocks")
|
||||
evtHash := fmt.Sprintf("%x", sha256.Sum256(hashBuf.Bytes()))[:7]
|
||||
eventbus.Publish(eventbus.EvtSQLInsertBlocks, context, len(bulk), evtHash)
|
||||
//eventbus.Publish(eventbus.EvtSQLInsertBlocks, context, current, total, len(bulk), evtHash)
|
||||
|
||||
stmt = fmt.Sprintf(BlocksFTSInsert, strings.Join(valueStrings, ","))
|
||||
if err = prepareExecInsertTx(tx, stmt, valueArgs); nil != err {
|
||||
|
|
|
@ -109,6 +109,7 @@ const (
|
|||
OCRImage = "task.ocr.image" // 图片 OCR 提取文本
|
||||
HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史
|
||||
DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
|
||||
ReloadUI = "task.reload.ui" // 重载 UI
|
||||
)
|
||||
|
||||
func ContainIndexTask() bool {
|
||||
|
|
Loading…
Add table
Reference in a new issue