I need to search exact word
example : “shoe”

and i set this attr exactOnSingleWordQuery : ‘word’
as i understand from the document
by the way the result match another words

Shoreditch : highligh [shore]
Shorts : highligh [shor]

Hi @tech2

I don’t think you have to set a specific attribute in order to match some queries. Instead, you might wanna look in your Dashboard->Indices->Ranking at the settings :

Typo-Tolerance and Interpretation->typoTolerance

Here is the description :

This setting has four different options:
true: activate the typo-tolerance (default value).
false: disable the typo-tolerance
min: keep only results with the lowest number of typo. For example if one result match without typos, then all results with typos will be hidden.
strict: if there is a match without typo, then all results with 2 typos or more will be removed. This option is useful if you want to avoid as much as possible false positives.

I think the min or maybe strict settings could work for your request.

There is other settings in this admin section also to tune the index as you wish. Someone working for Algolia will also may have a more creative / precise solution.

Hope this helps :slight_smile:

1 Like

As @pierre.aurele.martin said, I don’t think you need to tweak exactOnSingleWordQuery for what you want to achieve. To be honest, I never had to change the default value of this attribute myself.

From what I understand, you want to disable the typo-tolerance. In your example, if I understand correctly, when you type “shoe”, you have results for “shoreditch” and “shorts” as well. This is because of the typo-tolerance feature. The engine is assuming that maybe you wanted to type “shor”, but actually typed “shoe”.

Note that if results actually match “shoe”, they will still be returned, and will be returned in a higher position (no typo) than “shorts” and “shoreditch” (one typo).

That being said, let’s see how we can do what you’re asking.

  1. As suggested above, you can set typoTolerance to min or strict so results with too many typos will not be displayed if a result without typo is found

  2. You can completly disable typo-tolerance by setting disableTypoToleranceOnAttributes to a list of the attributes you want to disable.

I hope it answers your question, but if not, don’t hesitate to post back with a more concrete example. Ideally you could include the query typed, the expected results, the results you got and maybe screenshots.

Oh thanks I using disableTypoToleranceOnAttributes and it works perfectly !!!