#community-help

Querying Empty Strings in Typesense Cloud - Collection Search

TLDR Loic wanted to query empty strings in Typesense, but Jason explained this needs to be done when indexing as Typesense doesn't support querying blank keys.

Powered by Struct AI
Oct 08, 2022 (15 months ago)
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
03:29 PM
Hey guys,
In Typesense cloud - Collection search
How can I find if a parameter is equal to empty string?

(doc link is broken https://github.com/typesense/typesense/issues/749)
Oct 10, 2022 (14 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
01:49 PM
Typesense doesn’t support querying for null or blank keys, since the index only includes words. As a workaround, you’d need to create a new boolean field in each record and set it to true or false, depending whether your other field is blank or has a value
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
03:18 PM
I would actually need to query empty string to detect error/mistakes in the dataset
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:16 PM
You would have to do this at indexing time unfortunately.