Ruby
Python
PHP
Java
Node.js
Go
.NET
Filter Logic
You will find below the table of all operators and a detailed description of the filtering logic.
Operators Table
The API implements the following operators.
Note that not all operators are available for all property types. For instance floating point properties suffer from precision issues and therefore cannot be filtered using equality. Please refer to Property Types to find if an operator is available.
Quantifier for Repeated Property
For repeated properties, such as a list of many tags, most operators follow the exists set quantifier. This means that the API will return items where at least one of the repeated values satisfies the operator. For instance by using the filter tags:eq:family the API may return items with {"tags": ["action", "family"]} or {"tags": ["family"]}, but will not return any item with {"tags": []} or {"tags": ["action"]}.
Two operators do not follow this logic and instead implement the forall set quantifier: neq and notin. For these operators all repeated values must satisfy the operator. For instance by using the filter tags:notin:family,drama the API may return items with {"tags": []} or {"tags": ["action", "comedy"]}, but will not return any item with {"tags": ["action", "family"]} or {"tags": ["action", "drama"]}. This logic is only relevant for repeated properties because on a set of size 1, exists and forall are equivalent.
Combining Rules
By combining multiple filters you can achieve complex business rules.
Multiple Filters
When using multiple filters, the API will return items that satisfy all filters.
For instance using both price:gte:4 and price:lte:10 together will return only items with a price between 4 and 10.
Putting Everything Together
By default the operators neq or notin also return items with empty sets for this property. You may want to also exclude these items without the property. You can achieve this by adding a notempty filter on the same property.
When using multiple filters on the same repeated property, each filter is considered independently. Combining all the above logic is a great tool to generate complex business rules, but it can also produce un-intuitive filtering with repeated integers. For instance, an item with {"scores": [1, 2, 3, 4]} satisfies the filters scores:gt:3 & scores:lt:2.