Excluding search words in words

Hi there i’m after a way of specifically preventing matching to happen without changing any of the global typo tolerance settings?. We are putting together a car locator and I need to find a way of preventing matches on “Audio” being returned when a user inputs “Audi”.

All other tunings are great but i have some common edge cases i need to deal with.

Thanks Rob

1 Like

Hi @rob.severs,
You can easily disable typo-tolerance on certain words by defining those in the disableTypoToleranceOnWords index setting.

Doing that the query audio won’t match audi anymore.

1 Like

Hi Alex, many thanks for your reply buddy.

I did try that previously and following your reply i tried again just to make sure i wasn’t going mad, but to no avail. I’ve pasted a screen shot below which demonstrates the match even with typo tolerance disable set for the word audio. I did notice that in the search bar if i add an extra " " after inputting audi then the match on “audio” does not occur, but this won’t be normal behaviour from our users.

Any other suggestions? The ranking behaviour is as your default with a custom rank applied for price, and i have also set the global typo tolerance setting to “MIN”.

https://gyazo.com/3334b0042c1bd96b3c335badcc9f2f4a

hey alex, just noticed that you have misread my query input, i’m inputting “audi” and matching on “audio”, as opposed to inputting “audio” and matching “audi”.

As its not a typo but an actual matching word i think thats the problem, but need a way to stop this happening for specific words.

Hi @rob.severs,
Indeed, I didn’t realise at first that the matching is on the “audi” query and not on “audio” - sorry about that.
By design the engine returns any record matching prefix of words, and we don’t have any option to prevent that behaviour on some words, as it will lead to inconsistent results.

That being said, that can be solved following the index configuration below:

  1. Check that ranking formula is the default one. If not reset it.
  2. Make sure the options (where the word “audio” is) attribute is lower than make ( e.g “audi”), so the engine returns first records with the “audi” query matching the make instead of the options.

Let me know how it goes.

hey alex, thanks for your help on this, it may be what i’m trying to achieve isn’t possible. my index ranking is the default, and my list of options in the searchable attributes is lower than make, as can be seen in the screenprint. I get my Audi cars at the top of the sort but a lot of false positives lower down the search because of the “audio” match for other brands. It just looks odd as a i have make as a facet so when BMWs appear as a chosen facet its a bit odd.

I’m sure we can utilise the UI to at least highlight why. Great tool but some control over “word in words” as a future feature would be great - i only have a few edge cases i need to resolve so it maybe we have to pre-process our data to manage these before putting into the Algolia index. If you do think of anything please let me know.

Cheers

Rob

I had a quick chat with my colleagues, and this behaviour should be better handled with evolutions on the engine we’re planning to make in the next coming months. Thanks again for your valuable feedback!