#community-help

Filtering Based on Null or Specific Field Value in Typesense

TLDR Matheus asked how to filter documents on a null or specific field value. Jason suggested using a placeholder string to represent null values for filtering purposes.

Powered by Struct AI

1

May 13, 2022 (20 months ago)
Matheus
Photo of md5-1cabeb901c0e82b94d676d3d8b0926f3
Matheus
04:15 PM
How do I filter where I have a field matching a given string, and where it is also null? Say, I have a optional field called visibility_options. I want to get all documents which either have "visibility_options=="complete" or dont have that field
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:16 PM
Typesense does not index the absence of values. So you would have to create a special placeholder string to denote "null" and use that to filter....

1