Filtering by "Not Empty" in Databases
TLDR smileBeda and Vladimir asked about filtering by non-empty fields. Kishore Nallan explained the database doesn't record absent fields, recommending use of a placeholder instead.
Powered by Struct AI
2
1
3
3w
Solved
Nov 05, 2023 (3 weeks ago)
smileBeda
smileBeda
08:05 AMIs there a way to filter by “not empty”?
referring to
referring to
'filter_by': 'field_name:!='
(in this case I am attempting to get all results where this field is not empty, but it tells me it has to be a value…1
Vladimir
Vladimir
11:50 AMHave the same question. Truly necessary to filter by optional fields.
Kishore Nallan
Kishore Nallan
12:35 PMWe don't have a way to filter by empty/missing field value because, given the inverted index we keep for storing values, an absence of a field is simply not recorded (otherwise that consumes additional memory which is not always useful). You have to use a placeholder string/int value that conveys emptiness.
1
1
Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
Indexed 3005 threads (79% resolved)
Similar Threads
Handling Empty Fields and their Indexing
Eshwar asked about operators for EMPTY and NOT EMPTY conditions. Kishore Nallan clarified that empty values aren't indexed and suggested workarounds.
4
3mo
Solved
Searching for Empty Fields in Filter Query
Atul asked how to search for empty fields in filter queries. Jason responded that it's not possible directly, and suggested creating a new field to indicate empty fields.
3
7mo
Solved
Filtering Documents by Empty String
Serezha asked if it is possible to filter documents by empty string; Kishore Nallan informed that it is not possible as they do not store references to empty values.
2
9mo
Solved