Skip to content

Commit d33dd5e

Browse files
committed
feat(bootstrap): update syncIndexedCollections
to handle multiples index names
1 parent de0c27d commit d33dd5e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/bootstrap.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ async function syncIndexedCollections({
3737
const contentTypes = contentTypeService.getContentTypesUid()
3838

3939
for (const contentType of contentTypes) {
40-
const indexUid = meilisearch.getIndexNameOfContentType({ contentType })
41-
const indexInMeiliSearch = indexUids.includes(indexUid)
40+
const contentTypeIndexUids = await meilisearch.getIndexNamesOfContentType({
41+
contentType,
42+
})
43+
const indexesInMeiliSearch = contentTypeIndexUids.some(indexUid =>
44+
indexUids.includes(indexUid),
45+
)
4246
const contentTypeInIndexStore = indexedContentTypes.includes(contentType)
4347

4448
// Remove any collection that is not in Meilisearch anymore
45-
if (!indexInMeiliSearch && contentTypeInIndexStore) {
49+
if (!indexesInMeiliSearch && contentTypeInIndexStore) {
4650
await store.removeIndexedContentType({ contentType })
4751
}
4852
}

0 commit comments

Comments
 (0)