Skip to main content
The maxValuesPerFacet parameter limits how many facet values are returned per facet in the search response. This helps you focus the user experience on the most relevant facet values, especially in cases where a facet (like brand, author, or genre) has many possible values.
Don’t confuse maxValuesPerFacet with maxFacetHits. maxFacetHits sets the maximum number of returned results when searching for facet values.

Usage

The maximum value for maxValuesPerFacet is 1,000. You can set it higher but the engine will interpret it as 1,000.

Examples

Current API clients

Set the default number of facet values to retrieve

var response = await client.SetSettingsAsync(
  "ALGOLIA_INDEX_NAME",
  new IndexSettings { MaxValuesPerFacet = 100 }
);

Set the maximum number of facet values for the current query

This search setting will override the default maxValuesPerFacet setting for the current search.
var response = await client.SearchSingleIndexAsync<Hit>(
  "ALGOLIA_INDEX_NAME",
  new SearchParams(new SearchParamsObject { Query = "query", MaxValuesPerFacet = 20 })
);

Set the default number of facet values to retrieve

IndexSettings settings = new IndexSettings();
settings.MaxValuesPerFacet = 100;

index.SetSettings(settings);

Set the maximum number of facet values for the current query

This search setting will override the default maxValuesPerFacet setting for the current search.
var query = new Query("query")
{
  MaxValuesPerFacet = 20
};
I