Interface InputSearchFilter

Filters out products that don't match this filter. Parameters groups are sent based on match type that you are using. Only send parameters which belong to the filter type you are using.

Exists match - matches products that have the provided field. Example - match only products which are on sale

{
"field": "customFields.on-sale",
"hasValue": true
}

Prefix match - matches products that have one of provided prefixes. This match type should only be used for debugging. Example - match green and greenish color

{
"field": "customFields.color",
"prefix": [ "green" ]
}

Value match - matches products if they match any of provided values. Example - match products which are red:

{
"field": "customFields.color",
"value": [ "red" ]
}

Range match - matches products if value is in the specified range. Example - match products with price 10 <= price < 100

{
"field": "price",
"range": [
{
"gte": "10",
"lt": "100"
}
]
}

Logical match - matches products if nested filters satisfy the condition.

Example - match samsung and apple products:

{
"any": [ // logical OR
{
"field": "brand",
"value": [ "apple" ]
},
{
"field": "brand",
"value": [ "samsung" ]
}
]
}

// this is the same as using value match with multiple values

{
"field": "brand",
"value": [ "apple", "samsung" ]
}

Example - match samsung or apple phones:

{
"all": [ // logical AND
{
"field": "brand",
"value": [ "apple", "samsung" ]
},
{
"field": "customFields.item-type",
"value": [ "phone" ]
}
]
}

Example - match non apple products:

{
"not": [ // logical NOT
{
"field": "brand",
"value": [ "apple" ]
}
]
}

Logical filters can have any filter type in their nested array. That means that logical filters can nest other logical filters. Example - match all apple or samsung products, which cost more than a 100 or are bestsellers

{
"all": [
{
"field": "brand",
"value": [ "apple" ]
},
{
"any": [
{
"field": "price",
"range": {
"gt": "100"
}
},
{
"field": "customFields.best-seller",
"hasValue": true
}
]
}
]
}
interface InputSearchFilter {
    all?: InputSearchFilter[];
    any?: InputSearchFilter[];
    field?: string;
    hasValue?: boolean;
    not?: InputSearchFilter[];
    prefix?: string[];
    range?: InputSearchRangeFilter[];
    value?: string[];
}

Properties

Joins nested filters with logical AND

Joins nested filters with logical OR

field?: string

Product field to apply filter on

hasValue?: boolean

If true, matches all products which have the value on selected field. If false, matches all products which have no value in selected field.

Joins nested filters with logical AND and inverts match

prefix?: string[]

List of prefixes to match

List of range filters to apply

value?: string[]

List of values to filter by, joined by OR operator