Concepts / Managing results / Optional filters: performance concerns
Sep. 26, 2019

Optional Filters: Performance Concerns

Optional Filters, while powerful, come with some important limitations, particularly in terms of performance. Here are a few recommendations:

  • Define optionalFilters with the filterOnly() modifier, which tells the engine to treat the attribute as a simple filter instead of a facet. For example:
1
2
3
4
5
{
  attributesForFaceting: [
    "filterOnly(brand)"
  ]
}
  • Aim for less variety (low cardinality) on attributes being used for optionalFilters. For example, brand would typically be preferable to product; there are usually more products than brands.

  • Try to minimize the number of applied filters.
  • Aim for queries to return a smaller result set.
  • Finally, talk to us - we can apply sharding and other custom settings to optimize for your use case :)

Did you find this page helpful?