The filterPresent
condition is used to apply actions where there are particular filters in the facetfilters
. The filterPresent
condition has the following properties:
context
: The context of the condition. This must be set tofilterPresent
.values
: An array ofattribute:value
facet filters to match against. Theattribute
must be the name of the facet and thevalue
must be the value of the facet.
Below is an example of the facet_filters
condition where we are matching against the type
facet with the value movie
:
{
"search_settings": {
"query_rules": [
{
"id": "1",
"conditions": [
[
{
"context": "filterPresent",
"values": [{ "attribute": "type", "value": "movie" }]
}
]
],
"actions": [
// actions that will apply for conditions
]
}
]
}
}
Below is an example of the facet_filters
condition where we are matching against the type
facet with the value movie
and the genre
facet with the value drama
. Both the type
and genre
facet filters must be present for the query rule to be applied.
{
"search_settings": {
"query_rules": [
{
"id": "1",
"conditions": [
[
{
"context": "filterPresent",
"values": [
{ "attribute": "type", "value": "movie" },
{ "attribute": "genre", "value": "drama" }
]
}
]
],
"actions": [
// actions that will apply for conditions
]
}
]
}
}