How to configure search when my search term is in the middle of the word and it is not an "as-you-type" search?

Use case:
Let’s say, I’m selling pants in my shops. I have a bunch of products which are referred as “sweatpants”

I would like to achieve two things:

  • if someone searches for “pants” “sweatpants” also have to appear among the results - currently it is not happening
  • if I type “sweetpants” or “sweeetpants” it also should return the same results.

As I’m new to Algolia, please advise how I can configure the search like the above mentioned use case?

Hi there,

By default Algolia does not have infix or suffix matching. It won’t find matches when the word is in the middle or the end of a string, only the beginning. So for the search query “note” it will find matches of “notepad” and “notebook” but not “keynote.”

If you’d like to query the middle or end of a word, we do support it in certain use cases. Some information on that can be seen here:

A potentially better option would be to use Synonyms. You could create a synonym for “pants <> sweatpants” that would ensure records matching both terms will be displayed.

This will also address your second concern, as the typo tolerance on “sweatpants” will be in action to ensure proper results for “sweetpants” and “sweeetpants,” etc.

Hi Kevin,

thanks a lot for your answer.