How to get a list of possible filter values? #4245
-
Let's say I'm writing a search database that is structured but the values are unknown. Let it be an ecommerce search. In the UI I want to present a user a list of possible filters for their query. Meilisearch knows a field "color" is filterable. How do I get a list of possible values for this filter within a current query. Example: User types "jacket brandX" in the search query. We show w result page with filter color. We don't want to show the user all possible colours (although that's also a valid use case for Meilisearch). We want to show the user only colours that are matching the current query results. Would that be somewhat possible with current API? I'm reading the docs but don't find anything that would look like a promising candidate. Many thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @sznowicki 👋 What you want seems to be the facet distribution. When you send a search request with a query, and you ask for the facet distribution, only the facet values for the Could you tell me if you think it is the feature you searched for? |
Beta Was this translation helpful? Give feedback.
Hey @sznowicki 👋
What you want seems to be the facet distribution. When you send a search request with a query, and you ask for the facet distribution, only the facet values for the
color
facet for the list of documents that matches your query will be displayed.Could you tell me if you think it is the feature you searched for?
Have a nice day 🐬