diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index 37b47d430b5..92de470aa21 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -297,7 +297,7 @@ export class CipherService implements CipherServiceAbstraction { const userId = await this.userService.getUserId(); if ((this.searchService().indexedEntityId ?? userId) !== userId) { - await this.searchService().indexCiphers(); + await this.searchService().indexCiphers(userId, this.decryptedCipherCache); } return this.decryptedCipherCache; } diff --git a/src/services/search.service.ts b/src/services/search.service.ts index 58b4c96efda..454ee290974 100644 --- a/src/services/search.service.ts +++ b/src/services/search.service.ts @@ -26,6 +26,7 @@ export class SearchService implements SearchServiceAbstraction { } clearIndex(): void { + this.indexedEntityId = null; this.index = null; } @@ -42,6 +43,7 @@ export class SearchService implements SearchServiceAbstraction { this.logService.time('search indexing'); this.indexing = true; + this.indexedEntityId = indexedEntityId; this.index = null; const builder = new lunr.Builder(); builder.ref('id'); @@ -70,7 +72,7 @@ export class SearchService implements SearchServiceAbstraction { ciphers = ciphers || await this.cipherService.getAllDecrypted(); ciphers.forEach(c => builder.add(c)); this.index = builder.build(); - this.indexedEntityId = indexedEntityId; + this.indexing = false; this.logService.timeEnd('search indexing');