Querying Null and String Values in Typesense.

TLDR Andrew wondered if they could look for non-null and string values in Typesense, but Jason explained a workaround by creating a new boolean field at indexing time.

Powered by Struct AI
Feb 15, 2023 (10 months ago)
Photo of md5-7766f890de99fa72a6d81315691a6758
04:28 PM
How do i set a field to be able to look for a string, or null value? For instance


And have it return all documents where the videoUrl is not a null value but instead a string?
Photo of md5-8813087cccc512313602b6d9f9ece19f
05:20 PM
Typesense doesn’t have a way to do this, because it goes off of field values to build the index.

So you would have to create a new boolean field at indexing time, called say videoUrlIsNull and then use that to filter