Search code examples
facetalgolia

Algolia facet filter by empty/null value


Is there a way to filter hits by a property's value that is either null or an empty string?

i.e., show me all objects that do not have an author

facetFilters=author:null

facetFilters=author:''

Or include it in a list of OR values?

i.e., show me all objects with author set to Twain or that do not have an author

facetFilters=(author:Twain,author:null)

facetFilters=(author:Twain,author:'')


Solution

  • Unfortunately - as of today - Algolia doesn't support that. One work-around could be to push an extra value if it's null, like pushing author: 'unknown' that you could use to filter on.