Searching String Properties with Specific Conditions in Typesense

TLDR Serezha asked about searching string properties with strict conditions. Jason explained Typesense doesn't support endsWith search, but Kishore Nallan suggested using the `max_extra_suffix` parameter for infix searches for this purpose.

Photo of Serezha
Thu, 16 Nov 2023 16:39:31 UTC

Another question can we search property which type is string by strict condition for example if string ends with some substring

Photo of Jason
Thu, 16 Nov 2023 17:58:05 UTC

Typesense only supports startsWith (called prefix) search and contains (called infix) search. It does not have a endsWith search mode

Photo of Kishore Nallan
Kishore Nallan
Fri, 17 Nov 2023 02:58:35 UTC

Suffix search can be achieved via infix search by using the `max_extra_suffix` parameter which specify the maximum number of symbols after the query that can be present in the token. This can be set to `0` for pure suffix search. However note that infix search is useful only for single token searches. It's just too expensive to search all tokens against all records. There's no good way to do this.