核对一份文档
const r = await mn.api('/documents/' + bookmd5 + '/sync-status');
if (r.error && r.error.code === 'SYNC_DIAGNOSTIC_QUERY_FAILED') {
// 数据库侧查询全失败,不代表文档或笔记不存在
}
mn.log(r.state);{
"state": "available_and_published",
"database": {
"hasLearningData": true
},
"databaseQueryErrors": [],
"originalDocument": {
"expectedByCurrentSettings": true
},
"remainingUnverifiedMaterializedMappingCount": 0,
"activeDirectNoteReferenceCount": 12,
"studySetWithActiveNotesCount": 1
}文档与页面
获取文档同步状态
核对该文档的数据库引用、云端范围、本地与云端映射、下载队列与陈旧映射。
结论以 state 为准,该字段是整体判断。数据库一侧出现查询错误时,
响应里会列出这些错误,此时结论只是部分证据。外部文件提供方都报未核实。
带 verifyHash=1 才计算内容 hash。默认不算;打开之后要扫描整份已实体化的文件,大文档很慢。
GET
/
documents
/
{bookmd5}
/
sync-status
核对一份文档
const r = await mn.api('/documents/' + bookmd5 + '/sync-status');
if (r.error && r.error.code === 'SYNC_DIAGNOSTIC_QUERY_FAILED') {
// 数据库侧查询全失败,不代表文档或笔记不存在
}
mn.log(r.state);{
"state": "available_and_published",
"database": {
"hasLearningData": true
},
"databaseQueryErrors": [],
"originalDocument": {
"expectedByCurrentSettings": true
},
"remainingUnverifiedMaterializedMappingCount": 0,
"activeDirectNoteReferenceCount": 12,
"studySetWithActiveNotesCount": 1
}路径参数
文档的内容标识。取自 GET /study-sets/{topicid}/documents 响应里各项的 bookmd5、GET /ui-state 的 state.bookmd5,或 GET /search?scope=documents。
查询参数
计算内容 hash。默认不算。开启后要扫描整份已实体化的文件,大文档很慢。
可用选项:
1 响应
核对结果。
单个文档的同步核对。
核对结论。available_local_only 与 available_and_published 表示可用; waiting_for_icloud_download 与 mapped_but_not_materialized 表示内容尚未取得; 其余表示映射缺失、内容不一致或提供方未核实。
可用选项:
database_reference_without_document_mapping, waiting_for_icloud_download, library_record_without_document_mapping, available_local_only, available_and_published, verified_mismatch, icloud_error, mapped_but_not_materialized, unverified_external_provider Show child attributes
Show child attributes
非空表示数据库一侧的结论只是部分证据。
Show child attributes
Show child attributes
不为零时,该结论不能推广到其他映射上。