The hyphen (
-
) is a special character with a specific hard-coded behavior in Algolia's engine that cannot currently be fully replicated by other non-alphanumeric characters, even if those characters are added to separatorsToIndex
.For example, if you have a record with the SKU
'12-34'
, the following queries will all return a match for the record above:-
‘12-34’ (exact match)
-
‘12 34' (space instead of hyphen)
-
‘1234’ (concatenation of tokens on either side of hyphen)
If you have a record with a different non-alphanumeric character, though, such as SKU
'12/34'
, only the first two of these queries will return a match for that record:-
‘12/34' (exact match)
-
‘12 34' (space instead of '
/
') -
‘1234’ (concatenation of tokens on either side of '
/
', will not be a match)
Adding the '
/
' character toseparatorsToIndex
will make it searchable as a separate word instead of just treating it as a space, but you will still not get a match on query #3.