Facets
Facets are attribute categories for records that customers can use to further filter results. For example, if a customer searches for shirts, facets might include size, color, or material type. Within a Monetate Personalized Search API request, you can both retrieve applicable facets to display to customers and apply facets to filter results.
Retrieving facets is a computationally expensive operation. For best performance, you should minimize the number of times you retrieve them. For example, if you're paginating search results, retrieve facets only on the first query.
To retrieve facets in a Personalized Search API request, add the filters object to the parameters with filtersToReturn.enabled set to true.
The response returns a list of filters:
You can use this list of facets to present to the customer additional options to filter their results.
Applying facets to a query filters the results based on the selected facets and values. Run this query after a customer selects the facets they want to filter by. Apply facets in a query by using the applyFilters object.
Applying facets filters out any record for which the facet attribute doesn't match the specified value. You can apply multiple facets to further filter results.
The singleSelect parameter determines the result when multiple values are specified for a facet. When it's set to true, the records returned must contain all the values. When it's set to false, the records returned must contain at least one of the values.