Facets are where a search box turns into navigation. They only work when the numbers are honest: the «Nike (42)» next to a checkbox has to be exactly what the click returns. AACSearch computes facet counts for the current query and the filters already applied, in the same request as the hits, so they cannot drift apart.
Flag brand, category, size or any other field as a facet in the collection schema — strings, numbers and arrays are all supported.
Add facet_by to the search. The response returns every value of those fields with the number of results it would leave.
A click becomes a filter expression. The next response recomputes every other facet for the narrowed set.
A category listing is a search with a filter and no text. It reads the same facet counts as a text query, so faceted navigation, «refine your search» panels and browse pages all run on one code path — and merchandising rules apply to all of them.
A brand facet with four hundred values is not a filter, it is a wall. max_facet_values caps what is returned, and facet_query searches inside the facet itself — typing «sam» in the brand box returns «Samsung» with the match highlighted, without loading the full list.
To keep storefronts from requesting arbitrary facets, pin the configuration in a search profile: a browser key bound to a profile may only use the facets, fields and sort orders the profile defines.
Facet numbers reflect the text query and every active filter, not the whole collection.
facet_query filters facet values by prefix and highlights the match.
Ranges, lists, negation and boolean combinations in one filter_by expression — price, stock and attributes together.
React InstantSearch-compatible widgets render refinement lists, range inputs and current-refinement chips against the same API.
New to the term? The glossary explains Faceted search from first principles.
{
"q": "running shoes",
"query_by": "name,brand",
"facet_by": "brand,size,color",
"max_facet_values": 20,
"facet_query": "brand:ni",
"filter_by": "price:[3000..9000] && in_stock:true"
}
// -> facet_counts: [ { "field_name": "brand", "counts": [ { "value": "Nike", "count": 42 } ] } ]Explore more
The best way to evaluate a search platform isn't reading one more comparison table.
Only then make the decision.