strapimeilisearch

Indexing Strapi Dynamic Zones with Meilisearch plugin


I have a Strapi content type called portfolio, which has this Dynamic Zone:

"body": {
    "type": "dynamiczone",
    "components": [
        …
        "body.content-block-list",
        …
    ],
    "required": true
}

The body.content-block-list itself has an attribute blocks which is a repeatable component of type body.content-block:

"blocks": {
    "type": "component",
    "repeatable": true,
    "component": "body.content-block"
},

body.content-block has an attribute text:

"text": {
    "type": "richtext",
    "required": true
},

In the Strapi Meilisearch plugin, I’ve defined an index for the portfolio content type that looks like this:

portfolio: {
    indexName: 'content',
    populateEntryRule: []
}

What should the populateEntryRule look like to index the text attributes of the body.content-blocks in the body.content-block-lists in the dynamic zone?


Solution

  • From the “JavaScript query” section of the Rest API Documentation, I’ve determined that the configuration I need is

    portfolio: {
        indexName: 'content',
        populateEntryRule: {
            body: {
                populate: '*'
            }
        }
    }