This language is for development only. Switch to English (US) to try our product live.

How can I make queries within the middle of a word?

By design and for performances reasons, Algolia doesn’t natively support infix/suffix matching and therefore won’t find substrings starting at a non-zero index within a string. Only prefix matching is natively supported. That means that the query abc will match the record abcdef, but this record won’t be surfaced with queries cde or def.

Most of the time, such “partial” matches are dangerous for relevance, but there are some situations where making a search in a middle of a word or a number can be useful, such as with product references or part numbers. In such cases, we recommend that you create a new indexed attribute that will have in an array all the combinations of the attributes you need to partially match.
For example, if your primary attribute is product_number, we recommend that you create an extra attribute called alternative_product_number and add both of these attributes as Indexed attributes.
{
  "objectID": 1,
  "name": "I'm a Product name",
  "product_number": "abcdef",
  "alternative_product_number": ["bcdef", "cdef", "def", "ef", "f"]
}<br>
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk