feat(search-backend-node): check types in error handling

Co-authored-by: Emma Indal <emma.indahl@gmail.com>
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2022-06-28 13:47:58 +02:00
parent 19bcc9d795
commit 06f9999f4b
@@ -168,7 +168,7 @@ export class LunrSearchEngine implements SearchEngine {
type => !documentTypes || documentTypes.includes(type),
);
if (!indexKeys.length) {
if (documentTypes?.length && !indexKeys.length) {
throw new MissingIndexError(
`Missing index for ${documentTypes?.toString()}. This means there are no documents to search through.`,
);