mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
fix(nbstore): adjust indexer logic (#11355)
This commit is contained in:
@@ -452,10 +452,13 @@ export async function crawlingDocData({
|
||||
rootYDoc: YDoc;
|
||||
spaceId: string;
|
||||
docId: string;
|
||||
}): Promise<{
|
||||
blocks: IndexerDocument<'block'>[];
|
||||
preview?: string;
|
||||
}> {
|
||||
}): Promise<
|
||||
| {
|
||||
blocks: IndexerDocument<'block'>[];
|
||||
preview?: string;
|
||||
}
|
||||
| undefined
|
||||
> {
|
||||
let docTitle = '';
|
||||
let summaryLenNeeded = 1000;
|
||||
let summary = '';
|
||||
@@ -482,7 +485,7 @@ export async function crawlingDocData({
|
||||
}
|
||||
|
||||
if (blocks.size === 0) {
|
||||
return { blocks: [] };
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// find the nearest block that satisfies the predicate
|
||||
@@ -514,7 +517,7 @@ export async function crawlingDocData({
|
||||
}
|
||||
|
||||
if (!rootBlockId) {
|
||||
return { blocks: [] };
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const queue: { parent?: string; id: string }[] = [{ id: rootBlockId }];
|
||||
|
||||
@@ -381,6 +381,10 @@ export class IndexerSyncImpl implements IndexerSync {
|
||||
spaceId: this.status.rootDocId,
|
||||
docId,
|
||||
});
|
||||
if (!result) {
|
||||
// doc is empty without root block, just skip
|
||||
continue;
|
||||
}
|
||||
blocks = result.blocks;
|
||||
preview = result.preview;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user