Using helpers.highlight with an array of items - instantsearchjs v3

Given a property with this structure in an algolia index:

Property: ["some text","some text 2"," some text 3"]

Using {{#helpers.highlight}}{ "attribute": "Property" }{{/helpers.highlight}} doesn’t work.

In v2 you could use {{{_highlightResult.Property.value}}}.

How can one use the #helpers.highlight to display highlighted text for this?

1 Like

Hello, thanks for reaching us!
Could you help me reproduce your issue please?
You can use this sandbox to make a small reproducible example.
In the sandbox, InstantSearch.js@3.0.0 is used and you can see the templating works fine at app.js.

{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}

Here is an example of using the highlight helper with the property “Paragraphs” that follows the structure like I mentioned above:
Property: ["some text","some text 2"," some text 3"]
Aka: an array of items.

The #helpers.highlight helper doesn’t seem to support items in an array.

I didn’t fully understand your question before.
In this case, it’s hard to implement in string-based template.
You can try with function-based template.
This is a modified version based on your code sandbox.
Please let me know if you have any further question.
Thanks!