#community-help

Filtering by String Exclusion in Typesense

TLDR Jainil asked how to filter queries excluding certain words in Typesense. Jason clarified Typesense doesn't support partial word excludes and advised creating a GitHub issue for this feature request.

Powered by Struct AI
12
6mo
Solved
Join the chat
Jun 05, 2023 (6 months ago)
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
04:56 PM
Is there any way to filter by a string not containing a certain word?

I.e. I want to find all the people who have a job title with "Engineer" in it, but not "Backend"
04:57
Jainil
04:57 PM
I tried to do:

title:engineer && title:!backend

But that didn't seem to work.
05:47
Jainil
05:47 PM
And then followup, how to do this for multi-word exclusions?

I.e.
title:engineer && title:!`back end`
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:07 PM
Could you try:

title:engineer && title:!=`back end`
07:07
Jason
07:07 PM
Typesense doesn’t support partial word excludes in the filter
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
07:08 PM
Any plans on the roadmap for this?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:08 PM
Not at the moment, could you open a GitHub issue for it, so we can track demand
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
07:09 PM
Sure
07:12
Jainil
07:12 PM
Can you also explain how this is "partial word excludes" is different from keyword negation?
https://github.com/typesense/typesense/issues/155#issuecomment-736515398
07:12
Jainil
07:12 PM
Or is that only for the query
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:13 PM
Correct, That is only for the query - the q parameter
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a