I have a string attribute in my index, called externalUrl. I want to create a toggle-widget for my users which either shows all results, or filters out all results that have an externalUrl. What would be the best way to approach this problem?
Unfortunately, as for today, Algolia doesn’t support filtering on null values, which means that you can’t filter your records based on null values. We can only filter by something that is in the records.
However, what you can do is adding an extra value in those records like
If you’re using react-instantsearch, then you can simply use the toggle with the
Does that help?
Thanks, that clears things up for me.
Toggle docs show:
value* type: string Value of the refinement to apply on attributeName when checked.
I’m trying to toggle on a boolean attribute. The type specified for the value prop of
Toggle is a string though, and its not working.
Looping back here with the same issue, although now the docs have been updated to show
any as a value. Heads up the example using react-router encodes the boolean value and when it decodes it becomes a string.
I now have the issue that my request is doing a
facetFilters:["attributeName:undefined" search when its value is true.