fix(core): indexer data loss (#9216)

This commit is contained in:
EYHN
2024-12-20 06:10:50 +00:00
parent a53e231bad
commit f8e7abd018
2 changed files with 6 additions and 1 deletions

View File

@@ -143,12 +143,15 @@ export class DataStruct {
if (nid) { if (nid) {
await trx.objectStore('records').delete(nid); await trx.objectStore('records').delete(nid);
} else {
return;
} }
const indexIds = await trx const indexIds = await trx
.objectStore('invertedIndex') .objectStore('invertedIndex')
.index('nid') .index('nid')
.getAllKeys(nid); .getAllKeys(nid);
for (const indexId of indexIds) { for (const indexId of indexIds) {
await trx.objectStore('invertedIndex').delete(indexId); await trx.objectStore('invertedIndex').delete(indexId);
} }
@@ -266,6 +269,8 @@ export class DataStruct {
nodes.push(this.resultNode(record, options, match, nid)); nodes.push(this.resultNode(record, options, match, nid));
} }
console.log(nodes);
return { return {
pagination: { pagination: {
count: match.size(), count: match.size(),

View File

@@ -36,7 +36,7 @@ export class DocsIndexer extends Entity {
/** /**
* increase this number to re-index all docs * increase this number to re-index all docs
*/ */
static INDEXER_VERSION = 11; static INDEXER_VERSION = 17;
private readonly jobQueue: JobQueue<IndexerJobPayload> = private readonly jobQueue: JobQueue<IndexerJobPayload> =
new IndexedDBJobQueue<IndexerJobPayload>( new IndexedDBJobQueue<IndexerJobPayload>(