Docs
Guides
Conditions
Context

The context condition is used to match the context of the search. The context condition has the following properties:

  • context: The context of the condition. This must be set to context.
  • value: The value to match against. This must be an array of strings. The condition is met if the context of the search matches all of the values in the array.

Below is an example of the context condition:

{
"search_settings": {
  "query_rules": [
    {
      "id": "1",
      "conditions": [
        [
          {
            "context": "context",
            "value": ["test"]
          }
        ]
      ],
      "actions": [
        // actions that will apply for conditions
      ]
    }
  ]
}
}

This condition is useful if you want to apply a set of query rules to a specific context. You can set the context of a search by using the context parameter via the configure component on the frontend.

  <Configure
      ruleContexts={['ecommerce']}
  />