diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 9cd8feb5f..b2eb7b350 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -296,6 +296,12 @@ export class DocsService { status: "indexing", }; + // Clear old index if re-indexing. + if (reIndex) { + console.log("Deleting old embeddings"); + await this.delete(startUrl.toString()); + } + await this.add(siteIndexingConfig.title, startUrl, chunks, embeddings); this.docsIndexingQueue.delete(startUrl.toString());