Description
I am working on preparing our codebase for the new connector, as recommended in #1102 (comment)
In our project we have a UI component that allows filtering on several standard ranges, as well as selecting a custom range that can use the range chosen before as input. We have implemented this using a Facet and making this UI a custom FacetView.
You can see it running here (open the filterbox by clicking 'Toon filters'): https://www.platformrijksoverheidonline.nl/zoeken
When a user first picks a standard range, and then decides to customize, the previous choice is given as a starting off point, as a quality of life feature.
Internally this is done by using the current filtervalue to initialize the custom range picker.
This can no longer be done when switching to the new ES connector, because it exposes the set filter values as if they are like normal value facets, completely hiding the from/to values of the ranges.
As the filter values were complete FilterValueRange objects, this was easily retrieved from the data of the previous connector.
Also the docs written on this subject are no longer fully up to date:
It is mentioned in the docs that ranged facets have changed: https://www.elastic.co/guide/en/search-ui/current/api-connectors-elasticsearch.html#api-connectors-elasticsearch-applying-filters-to-range-facets
The following is still mentioned:
setFilter("visitors", { name: "10001 - 100000", // name of the option from: 10001, // both from and to will be ignored to: 100000 });
but so far this does not seem to work, and in my codebase it seems it should be like this:
setFilter("visitors", "10001 - 100000"); // directly the name of the option, as string and not wrapped in an object