Require exact match on specific word

I’m having trouble getting a specific functionality to work for certain search terms. It’s difficult to generalize, so I’ll use the exact scenario. Our index contains vehicles and the attributes make and model are both searchable. We have two specific vehicles that are giving an issue, the “Ford F-150” and the “Ram 1500”.

If a user searches “f-150”, we correctly only see the Ford result and not the Ram result. If a user searches “f150”, it will match the “150” in “1500” and return both the Ford and the Ram vehicle, which we do not want. Is there any way to ensure that we get the correct functionality?

Outside of the default settings, I’ve tried adding one way synonyms for “f150” → “f-150”, adding “1500” and “f-150” to the list of disableTypoToleranceOnWords, and disabling allowTyposOnNumericTokens.

@brett.myers welcome to the community!

I agree, this is a little tricky of an issue. I populated an index of my own with some car models, looked at what it would take to get this working, and wanted to provide you with some options:

  1. On a case-by-case basis, add confusing terms to the disableTypoTolerenceOnWords setting for the Index. For example: ['f150']. You’ll need a synonym to convert from f150f-150 or else no results would be returned for that query. (I see you already messed around w/ this)
  2. Increase the minWordSizeFor1Typo setting in your Index so that it does not pick up models and only manufacturers (may have negative side-effects potentially)

I took a look through the models and there weren’t very many that would be confusing, but I think this depends if you are including global brands. I personally believe this kind of use case will be better served by our hybrid API coming next year, which you can read more about here.

With that said, happy to help further - just let us know! Thanks!