API Reference / API Parameters / ruleContexts
Feb. 26, 2019
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 activate a maximum of 10 contexts at query time.

Examples

1
2
3
4
5
6
$results = $index->search('query', [
  'ruleContexts' => [
    'front_end',
    'website2'
  ]
]);

Did you find this page helpful?