Only shows the highlighted line

Good evening, I use algolia istantsearch with javascript

<script src="https://cdn.jsdelivr.net/npm/algoliasearch@3.32.0/dist/algoliasearchLite.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@3.0.0"></script>

I can’t understand how to show, in a long text, only the line with the word found and highlighted.

The example in the screen below, when the search key is entered, the product description only shows the line in which the search key is present.

How can I achieve this result?

Hi @giacomosilli, to only show the part of the attribute where the match was found you’ll want to use the snippet Instant Search widget or the part of the JSON response that is called _snippetResult. Just make sure the attribute in question is set as an attribute for snippeting.

Hope this helps!

1 Like