An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:memo: Generalize SQL indexing guidance for block writes https://github.com/siyuan-note/siyuan/issues/19841
Daniel04d494bfb4b4
diff --git a/docs/API.ja.md b/docs/API.ja.mdindex b808357068..30f2973e0a 100644--- a/docs/API.ja.md+++ b/docs/API.ja.md@@ -1324,7 +1324,7 @@ if (response.code === 0 && response.data) {}```-`appendBlock` と `insertBlock` はブロックツリーの保存後に応答しますが、SQL の `blocks` テーブルは非同期で索引付けされます。書き込み成功後に `POST /api/sqlite/flushTransaction` を呼び出し、`code: 0` の応答を待ってから `/api/query/sql` で検索してください。`getBlockKramdown` はブロックツリーを読み取るため、SQL の索引付けが終わる前でも全文を返す場合があります。Kramdown、DOM、SQL の列は異なる表現であり、正規化されたプレーンテキストではありません。+ブロックを書き込む API は、ブロックツリーのトランザクションが確定していても、非同期の SQL 索引付けが終わる前に応答する場合があります。その書き込みを直後の `/api/query/sql` で読み取る必要がある場合は、書き込み後に `POST /api/sqlite/flushTransaction` を呼び出し、`code: 0` の応答を待ってから SQL を照会してください。例えば、`getBlockKramdown` はブロックツリーを読み取るため、SQL の索引より先に新しい内容を返す場合があります。Kramdown、DOM、SQL の列は異なる表現であり、正規化されたプレーンテキストではありません。## テンプレートdiff --git a/docs/API.md b/docs/API.mdindex a61dccf717..5e1d26cbda 100644--- a/docs/API.md+++ b/docs/API.md@@ -1332,7 +1332,7 @@ Note: To ensure data security, access to this interface is prohibited in Publish}```-`appendBlock` and `insertBlock` commit the block tree before returning, while the SQL `blocks` table is indexed asynchronously. After a successful write, call `POST /api/sqlite/flushTransaction` and wait for `code: 0` before querying `/api/query/sql`. `getBlockKramdown` reads the block tree, so it can return the full content before the SQL index catches up. Kramdown, DOM, and SQL columns are different representations and are not normalized plain text.+Block-writing APIs can return after their block-tree transaction is committed but before asynchronous SQL indexing has caught up. If a subsequent `/api/query/sql` call must observe that write, call `POST /api/sqlite/flushTransaction` after the write and wait for `code: 0` before querying SQL. For example, `getBlockKramdown` reads the block tree and can show newly written content before the SQL index does. Kramdown, DOM, and SQL columns are different representations and are not normalized plain text.## Templatesdiff --git a/docs/API.zh-CN.md b/docs/API.zh-CN.mdindex 708599600c..978c31016f 100644--- a/docs/API.zh-CN.md+++ b/docs/API.zh-CN.md@@ -1329,7 +1329,7 @@ if (response.code === 0 && response.data) {}```-`appendBlock` 和 `insertBlock` 返回前已提交块树,但 SQL `blocks` 表会异步建立索引。写入成功后,先调用 `POST /api/sqlite/flushTransaction` 并等待返回 `code: 0`,再查询 `/api/query/sql`。`getBlockKramdown` 读取块树,因此可能在 SQL 索引完成前就返回完整内容。Kramdown、DOM 和 SQL 列是不同的内容表示,均非规范化纯文本。+写块接口可能在块树事务已提交、异步 SQL 索引尚未完成时返回。如需随后通过 `/api/query/sql` 立即读取该写入,请在写入后调用 `POST /api/sqlite/flushTransaction`,等待返回 `code: 0`,再查询 SQL。例如,`getBlockKramdown` 读取块树,可能比 SQL 索引更早显示新写入的内容。Kramdown、DOM 和 SQL 列是不同的内容表示,均非规范化纯文本。## 模板