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

Last updated 29 March 2017

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”] }


Did you find this page helpful?

We're always looking for advice to help improve our documentation! Please let us know what's working (or what's not!) - we're constantly iterating thanks to the feedback we receive.

Send us your suggestions!