How to highlight value from an array?

Hi, I’m using this template @algolia/autocomplete-example-preview-panel-in-modal - CodeSandbox and I woud like to highlight results from an attribute that is an array. How should I do ?

For example with this data:

      "car": "BMW",
      "models": ["abc", "def", "ghi"],

this works: <components.Highlight hit={preview} attribute="car" />
but not this <components.Highlight hit={preview} attribute="models" />

I’m getting this error:
[Autocomplete] The attribute "models" described by the path ["models"] does not exist on the hit. Did you set it in attributesToHighlight?

You can pass an array to highlight, which is the path to traverse to retrieve the item, this also works with numbers in arrays:

In your case that would be:

{, i) => (
    {i !== 0 ? ", " : ""}
      attribute={["models", i]}

(don’t forget to add attributesToHighlight as well for that attribute)