#community-help

Handling Infix Search in Typesense

TLDR Lalit asked about handling infix search in Typesense. Dima suggested adding '-' to token separators. Lalit anticipated more special cases. Kishore Nallan argued infix search might be CPU intensive and might be better for handling initial typos.

Powered by Struct AI
Aug 15, 2023 (1 month ago)
Lalit
Photo of md5-c1435479d3d68f5c9bf5faef1c3ba12f
Lalit
01:34 PM
Hi kishore

i have item named T-shirt

i searched with keyword shirt
it gives me no result
infix: 'always',
infinix does the work just wanted toa sk that if this is the right approach
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
01:35 PM
Hi Lalit! It can be solved with added - to token_separators

https://typesense.org/docs/0.24.1/api/collections.html#schema-parameters

> For e.g. you can add - (hyphen) to this list to make a word like non-stick to be split on hyphen and indexed as two separate words.
Lalit
Photo of md5-c1435479d3d68f5c9bf5faef1c3ba12f
Lalit
01:36 PM
this will only work with separartor - i may have many such special cases
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:28 PM
Typesense only supports prefix search by default. There are no easy options to do infix search. The infix option is cpu intensive. Unless you are looking to only handle typos on the first two chars?