Description
Let's say we are using the facet with the following options
:
const options = {
facets: {
location: [{ type: 'value', size: 6 }],
},
disjunctiveFacets: ['location'],
filters: { location: ['Canada', 'United States']},
};
client
.search('yoga', options);
.then(({ info }) => {
console.log(info.facets.location);
});
If the location Canada
is not in the first 6 most popular facet results for this query, it is not included in info.facets.location
. Only the 6 most populars are accessible. However, I can see we retrieve this data from the request that is not Facet-Only
(since it returns only the two facets that we used to filter).
If we use the facets results to display checkboxes (with multiple selection active), it is a problem since the Canada option will not be shown, and then cannot be remove from the filters. We need to "cache" that selected value, and then display it without it's count.
I don't know if this should be implemented at a endpoint level, but I think the active filters should be returned as the first values when retrieving facet values, so that the UI can be implemented out-of-the-box. Even if they are empty (count = 0). That way, it will be easier to implement a UI based on them.