RangeInput without min and max

Hi,

Would it be possible to use the RangeInput control completely without min and max value? I’m using the vue ais-range-input and I want to give my end user the possibility to enter any value they want in the min and max field. I don’t want them to be limited by the min and max of that value in my index.
I’m currently using a default slot where the min/max handling is removed from the UI, but I figured out that calling refine is just not refining when the value that I provide is not within the range that is returned in the facet_stats. The underlying connectRange seems to be preventing this as it’s only performing a query when isMaxValid and isMinValid are true. When no min/max is provided this will use the facet_stats. Is there a way to completely work without any range at all?

Solutions I’ve tried so far:

  1. Define Inifity as min and max. This is not working as it’s just setting the default behaviour.
  2. Set 0 and 99999999999 as min and max. This is always adding the 0 and 999999999999 to the query + url. I guess we will be charged for this when I have 5 fields doing this? Besides that I don’t want to have these values in my url by default.

The only solution I see now is overriding the rangeInput connector, but that doesn’t feel like the right solution for this.

Anybody overcome this issue or has an idea on how to solve it?

Hi there,
thanks for reaching out.

Your solution (1) doesn’t work because connectRange checks if it’s a finite number.
The solution (2) can be a workaround at the moment. Adding query parameters won’t charge you more.
If you don’t want it to be in your url, you could remove it by customising routing.

It’s also possible to have a custom connector for this specific case.
I hope to provide an option to solve this out-of-box, but I’m afraid I cannot guarantee when it can be done.

Let me know how it goes or if you have any other questions.
Thanks.

Hi,

I’ve been tinkering around with your solution but it’s not working for me. Most of the fields we want to search with the range input are optional fields.
Providing a min/max will automatically apply that filter, thus create a query where the results are filtered with the default min/max. That means that all records where this field is not set, will not be returned.

Is there anything we can do to prevent that?

I’ve been thinking about a custom connector for this, but that’s the absolute last option that we want to go for. We prefer to use your connectors to avoid issues when upgrading. Having our own connector for this could potentially result in a more complex upgrade process in the future and therefor we want to avoid that.

Hi @arjanwestdorp,

At the moment not with our out-of-the-box widgets. You are indeed correct that the min/max act as a filter ( which is what you would expect from a refinement list ).

You also mentioned: “That means that all records where this field is not set, will not be returned.”

This is a good piece of information to share as Algolia only searches for actual values. We have no way to search for “null” or “missing” values or attributes.

Going forward, if you think you’ll need to filter or select for these records where the field is not set, please take a look at this document: