Matchers
The list of available condition's matchers based on field and value types
The valid matchers you can use in a condition or aggregation depend on the type of field on which you want to check the condition or perform the aggregation (e.g. you cannot check if a string such as a tag or an SKU code is greater than another). Some matchers (e.g. eq
, gteq
, et.) require a value to be compared against, some others (e.g. null
, present
, etc.) don't.
For the comparison to work, the provided value must be of the correct type (e.g. you cannot check if a string such as a tag or an SKU code is equal to a number).
Value required
You can find here below the complete list of the available matchers the require a value to be defined in the related condition in order to work:
eq
Matches if the field
value is equal to the provided value
.
not_eq
Matches if the field
value is not equal to the provided value
, not including null values.
lt
Matches if the field
value is less than the provided value
.
lteq
Matches if the field
value is less than or equal to the provided value
.
gt
Matches if the field
value is greater than the provided value
.
gteq
Matches if the field
value is greater than or equal to the provided value
.
multiple
Matches if the field
value is a multiple of the provided value
(i.e it can be divided by the provided value without a remainder).
matches
does_not_match
start_with
Matches if the field
value starts with the provided value
.
not_start_with
Matches if the field
value does not start with the provided value
.
end_with
Matches if the field
value ends with the provided value
.
not_end_with
Matches if the field
value does not end with the provided value
.
gt_lt
Matches if the field
value is greater than the first value of the provided value
array and lower than the second.
gteq_lt
Matches if the field
value is greater than or equal to the first value of the provided value
array and lower than the second.
gt_lteq
Matches if the field
value is greater than the first value of the provided value
array and lower than or equal to the second.
gteq_lteq
Matches if the field
value is greater than or equal to the first value of the provided value
array and lower than or equal to the second.
is_in
Matches if the field
value is included in the provided value
array.
is_not_in
Matches if the field
value is not included in the provided value
array.
array_match
Array match
When the field
value is an array, the array_match
matcher enables you to check multiple inclusion/exclusion conditions on different arrays provided within the value
object using the following additional operators:
in_and
Matches if the field
array contains all the items of the provided in_and
array.
in_or
Matches if the field
array contains contains at least one of the items of the provided in_or
array.
not_in_and
Matches if the field
array contains none of the items of the provided not_in_and
array.
not_in_or
Matches if the field
array does not contain at least one of the items of the provided in_or
array.
Each of the operators above can be used once within the value
object of the array_match
matcher. If different operators are present, they are evaluated according to and AND
logic (i.e. the array_match
will match only if all the conditions in the value
object are satisfied).
Example
The following condition identifies the products in an order that are tagged as "man-accessories" or "women-accessories" and at the same time are not associated with both "sales" and "black-friday" tags (e.g. a line item associated with an SKU tagged as "men-accessories" and "sales" would match, while a line item associated with an SKU tagged as "women-accessories", "sales", and "black-friday" wouldn't match).
Aggregations
The matchers you can use when aggregating the matches of a condition or the targets of an action are a subset of the list above. Namely (since they have to be checked against the results of an aggregation performed via operators that return numbers), the ones that can be applied to integer fields:
eq
not_eq
lt
lteq
gt
gteq
multiple
For the same reason also the value
attribute to be used within an aggregation must be of type integer.
Value not required
You can find here below the complete list of the available matchers for which you don't have to provide a value in the related condition:
blank
The field
value is null or empty.
present
The field
value is not null and not empty.
null
The field
value is null.
not_null
The field
value is not null.
Last updated