#community-help

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
2
8mo
Solved
Join the chat
Feb 15, 2023 (8 months ago)
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
04:28 PM
How do i set a field to be able to look for a string, or null value? For instance

videoUrl:!=null

And have it return all documents where the videoUrl is not a null value but instead a string?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
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