API Reference / API Parameters / ruleContexts
Type: list of strings
Engine default: []
Parameter syntax
'ruleContexts' => [
  'context_value',
  ...
]

Can be used in these methods:

About this parameter

Enables contextual rules.

Provides a list of contexts for which rules are enabled. Contextual rules matching any of these contexts are activated, as well as generic rules.

Usage notes

  • When empty, only generic rules are activated.

  • For performance reasons, you may pass up to 10 different contexts to the API at a time at query time.

Examples

1
2
3
4
5
6
$results = $index->search('query', [
  'ruleContexts' => [
    'front_end',
    'website2'
  ]
]);
Did you find this page helpful?