Does the widget support disjunctive (OR) operator?
E.g. being able to show a RangeSlider component and make it work like
min <= x <= max OR x == -1
Or perhaps there's some kind of a hook and a developer can set up some interceptor at the "Send Algolia Request" stage to modify the Algolia query object being sent given that Algolia itself does support the OR operator?
In case of the second "hook" approach it would be diffucult though to implement some kind of a toggle saying "Show/hide x-es with value -1", but if it's the only way then there would be no choice.
I see, so seems that the way to go is implementing a custom widget for such purpose
https://github.com/algolia/react-instantsearch/blob/master/docgen/src/guide/Custom_connectors.md
I guess this issue can be closed then.
Easiest if you just want to pass down some raw parameters is to use the Configure widget https://community.algolia.com/react-instantsearch/guide/Search_parameters.html along with using the filtering parameter of Algolia: https://www.algolia.com/doc/guides/searching/filtering/#basic-filtering
@vvo As I can judge, filtering parameter is being constructed somewhere inside algolia helper internals so a developer can't just pass the filter parameter because it would get rewritten (or rewrite the already built one).
The way we see it is to extend algolia helper to include either a proper "add disjunctive refinement" method which works like a < 1 OR a = 0 or add an "add extra filter" method which works by concatenating the already built filter with our custom supplied substring.
cc @oseibonsu
If you pass filters (with an s sorry) to Configure, that's sent directly to Algolia without any transformation, so if you need to pass a < 1 OR a = 0 without having a widget linked then try to use that first?
@vvo But what if we already have wigdets for b and c faceted attributes of the index and also need a custom filter for a: will those <Configure filters="a < 1 OR a = 0"/> overwrite the b and c widget refinements the user has already selected?
@catamphetamine The <Configure /> widget will not override the filters attribute since the helper never set filters directly. Internally it will set the different variant of filters, numericFilters, facetFilters, etc.. Then when you explicitly set the filters they will be combine with an AND as it's explain in our documentation.
@samouss Oh, so it doesn't override it, that's cool.
Seems that it could be a viable solution then, only if it did account for adding multiple filters like an object of shape { filter1: '("author:Stephen King" OR "genre:Horror")', filter2: ... } because there can be potentially two widgets contending for the same filters property.
Still it's better than nothing and is quite suitable for many cases, maybe we will resort to it first.
So basically what <Configure/> widget does is it passes all its props to index.search({}) method?
Yes, configure exists to set extra query parameters