Skip to content
Snippets Groups Projects
Unverified Commit a29d8351 authored by Philipp Serrer's avatar Philipp Serrer Committed by GitHub
Browse files

fix: setDocumentHash should be async (#868)

parent da1f0252
No related branches found
No related tags found
No related merge requests found
---
"llamaindex": minor
"docs": minor
---
setDocumentHash should be async
......@@ -271,7 +271,7 @@ custom_edit_url: null
### setDocumentHash
`Abstract` **setDocumentHash**(`docId`, `docHash`): `void`
`Abstract` **setDocumentHash**(`docId`, `docHash`): `Promise`<`void`\>
#### Parameters
......
......@@ -271,7 +271,7 @@ custom_edit_url: null
### setDocumentHash
`Abstract` **setDocumentHash**(`docId`, `docHash`): `void`
`Abstract` **setDocumentHash**(`docId`, `docHash`): `Promise`<`void`\>
#### Parameters
......
......@@ -271,7 +271,7 @@ custom_edit_url: null
### setDocumentHash
`Abstract` **setDocumentHash**(`docId`, `docHash`): `void`
`Abstract` **setDocumentHash**(`docId`, `docHash`): `Promise`<`void`\>
#### Parameters
......
......@@ -95,7 +95,7 @@ export abstract class BaseIndex<T> {
[nodeParserFromSettingsOrContext(this.serviceContext)],
);
await this.insertNodes(nodes);
this.docStore.setDocumentHash(document.id_, document.hash);
await this.docStore.setDocumentHash(document.id_, document.hash);
}
abstract insertNodes(nodes: BaseNode[]): Promise<void>;
......
......@@ -281,7 +281,7 @@ export class KeywordTableIndex extends BaseIndex<KeywordTable> {
await docStore.addDocuments(documents, true);
for (const doc of documents) {
docStore.setDocumentHash(doc.id_, doc.hash);
await docStore.setDocumentHash(doc.id_, doc.hash);
}
const nodes = serviceContext.nodeParser.getNodesFromDocuments(documents);
......
......@@ -138,7 +138,7 @@ export class SummaryIndex extends BaseIndex<IndexList> {
await docStore.addDocuments(documents, true);
for (const doc of documents) {
docStore.setDocumentHash(doc.id_, doc.hash);
await docStore.setDocumentHash(doc.id_, doc.hash);
}
const nodes =
......
......@@ -19,7 +19,7 @@ export class DuplicatesStrategy implements TransformComponent {
for (const node of nodes) {
if (!(node.hash in hashes) && !currentHashes.has(node.hash)) {
this.docStore.setDocumentHash(node.id_, node.hash);
await this.docStore.setDocumentHash(node.id_, node.hash);
nodesToRun.push(node);
currentHashes.add(node.hash);
}
......
......@@ -32,7 +32,7 @@ export abstract class BaseDocumentStore {
abstract documentExists(docId: string): Promise<boolean>;
// Hash
abstract setDocumentHash(docId: string, docHash: string): void;
abstract setDocumentHash(docId: string, docHash: string): Promise<void>;
abstract getDocumentHash(docId: string): Promise<string | undefined>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment