Recover the suggested value

Hello,
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>

Is there a way to recover from the JSON the “correct” value that algolia suggests during a search?

For example, if i search in my site “cuio” algolia suggests “ciò”.

Is there a parameter in the JSON to retrieve the suggested value?

Something like search._suggested or item.typotolerance

Istantanea_2019-11-05_10-49-07

Hello,

Thank you for contacting us.

You can see in the doc here what you get from the response.

We don’t have something like item.typotolerance, but you can get the result of this from the _ _highlightResult field which will tell you what has been matched.

Thanks,
Guy

I’m currently doing as you suggested:

item._highlightResult.meta_title.value

trying to extrapolate only the suggested text between the <mark> tag, unfortunately there are too many cases to manage.

It would be nice to have a field like typoWords or something like matchedWords array

Hi @giacomosilli - Thank you for the feedback! For now, the _highlightResult field is what we have available, but indeed we can consider your suggestion for future product enhancement.

2 Likes