Appearance
Filters
Within Relewise, filters are a way to narrow the results of a request to only include entities that fulfill certain criteria. Filters are thus used to tweak and optimize the results that the Relewise engine returns, such as specifying that a search should only include certain categories or product types, or excluding sold-out products from recommendation sliders.
In Relewise, filters are inclusive. This means that a filter for Product ID 12345
will only allow that particular product to be returned in the request. To make filters exclusive, it can be negated, by specifying the negated
setting to be true
.
Filters are not to be confused with facets, which are used to narrow down search results after they have been returned from Relewise.
The following is a list of filters available in Relewise. The list is not exhaustive, but offers an overview of the most commonly used filters you may need. For the full list, consult our swagger page.
This article groups filters on the basis of function. That is to say that the DataFilter
type of filters is an overall category for a series of entity-specific filters that all function identically. For those filters that are entity-specific, the full name of the filter is used as the header.
AndFilter
The And filter combines two sub-filters, and demand that both filter conditions be true before the filter takes effect. This lets you combine to different conditions, for more advanced filter setups.
Usecase example
json
{
"$type": "Relewise.Client.Requests.Filters.AndFilter, Relewise.Client",
"Filters": [
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "InStock",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.EqualsCondition, Relewise.Client",
"Value": {
"Type": "Boolean",
"Value": true,
"IsCollection": false
},
"TypeName": "EqualsCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
},
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryIdFilter, Relewise.Client",
"CategoryIds": [
"category-1"
],
"EvaluationScope": "ImmediateParent",
"TypeName": "ProductCategoryIdFilter",
"Negated": false
}
],
"TypeName": "AndFilter",
"Negated": false
}
AssortmentFilter
BrandAssortmentFilter, ContentCategoryAssortmentFilter, ContentAssortmentFilter, ProductCategoryAssortmentFilter, ProductAssortmentFilter, VariantAssortmentFilter
The Assortment filters are used to define if an entity belongs to a specific assortment.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductAssortmentFilter, Relewise.Client",
"Assortments": [
1
],
"TypeName": "ProductAssortmentFilter",
"Negated": false
}
DataFilter
BrandDataFilter, ContentDataFilter, ContentCategoryDataFilter, ProductCategoryDataFilter, ProductDataFilter, VariantDataFilter
The Data filter specifies that a certain datakey on an entity must in some way conform to the filter's specifications.
The Data filter is perhaps the most versatile filter within Relewise, and can be used for a large number of things. Common usecases might be excluding entities that are not available yet, or ensuring entities have a specific tag.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "tags",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.ContainsCondition, Relewise.Client",
"Value": {
"Type": "String",
"Value": "toast",
"IsCollection": false
},
"ValueCollectionEvaluationMode": "All",
"TypeName": "ContainsCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
}
DataHasKeyFilter
BrandDataHasKeyFilter, ContentCategoryDataHasKeyFilter, ContentDataHasKeyFilter, ProductCategoryHasDataKeyFilter, ProductDataHasKeyFilter, VariantDataHasKeyFilter
This filter evaluates whether a specific key exists on an entity or not.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDataHasKeyFilter, Relewise.Client",
"Key": "datakeyName",
"TypeName": "ProductDataHasKeyFilter",
"Negated": false
}
DisabledFilter
BrandDisabledFilter, ContentCategoryDisabledFilter, ContentDisabledFilter, ProductCategoryDisabledFilter, ProductDisabledFilter, VariantDisabledFilter
The Disabled filter lets you filter on whether an entity is disabled or not. This is useful for performing queries where you want to identify all entities of a certain type that are disabled on the dataset.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDisabledFilter, Relewise.Client",
"TypeName": "ProductDisabledFilter",
"Negated": false
}
IdFilter
BrandIdFilter, ContentIdFilter, ContentCategoryIdFilter, ProductAndVariantIdFilter, ProductCategoryIdFilter, ProductIdFilter, VariantIdFilter
The Id Filter lets you filter on a specific ID or list of IDs. It can also be used in its negated state to exclude a specific list of IDs from your request results.
Common usecases for the Id filter include:
- Limiting products to only belong to a particular product category or brand
- Excluding a list of IDs from search or recommendation results by negating the filter.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductIdFilter, Relewise.Client",
"ProductIds": [
"prod-1",
"prod-2",
"prod-4"
],
"TypeName": "ProductIdFilter",
"Negated": false
}
CategoryHasAncestorFilter
ContentCategoryHasAncestorFilter, ProductCategoryHasAncestorFilter
The CategoryHasAncestor filter is used to specify that a category entity's ancestor must be one of the specified category IDs. An ancestor is a category that exists anywhere above the specified category within the category hierarchy.
Read more about Category Scopes here
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasAncestorFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasAncestorFilter",
"Negated": false
}
CategoryHasChildFilter
ContentCategoryHasChildFilter, ProductCategoryHasChildFilter
The CategoryHasChild filter is used to specify that a category entity's child must be one of the specified category IDs. A child is a category that exists immediately below the specified category within the category hierarchy.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasChildFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasChildFilter",
"Negated": false
}
CategoryHasParentFilter
ContentCategoryHasParentFilter, ProductCategoryHasparentFilter
The CategoryHasParent filter is used to specify that a category entity's parent must be one of the specified category IDs. A parent is a category that exists immediately above the specified category within the category hierarchy.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasParentFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasParentFilter",
"Negated": false
}
CategoryLevelFilter
ContentCategoryLevelFilter, ProductCategoryLevelFilter
The CategoryLevel filter is used to specify that a category entity must exist at a certain level or levels of the category hierarchy. For instance, if a product category has two categories above it in the hierarchy, it exists at category level 3.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryLevelFilter, Relewise.Client",
"Levels": [
1,
2
],
"TypeName": "ProductCategoryLevelFilter",
"Negated": false
}
RecentlyViewedByUserFilter
ContentCategoryRecentlyVieweByUserFilter, ContentRecentlyViewedByUserFilter, ProductCategoryRecentlyViewedByUserFilter, ProductRecentlyViewedByUserFilter
The RecentlyViewedByUser filter is used to specify that an entity must have been viewed by the user within a specified time frame. This can be specified either as a specific timestamp with SinceUtc
, or as a SinceMinutesAgo
value that looks back at the last X minutes of the user's activity.
Usecase Example
Using UTC Timestamp
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyViewedByUserFilter, Relewise.Client",
"SinceUtc": "2025-01-01T00:00:00+01:00",
"TypeName": "ProductRecentlyViewedByUserFilter",
"Negated": false
}
Using SinceMinutesAgo
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyViewedByUserFilter, Relewise.Client",
"SinceMinutesAgo": 10080,
"TypeName": "ProductRecentlyViewedByUserFilter",
"Negated": false
}
HasCategoriesFilter
ContentHasCategoriesFilter, ProductHasCategoriesFilter
The HasCategories filter is used to define that a content or product entity must have at least one category associated with it.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductHasCategoriesFilter, Relewise.Client",
"TypeName": "ProductHasCategoriesFilter",
"Negated": false
}
ListPriceFilter
ProductListPriceFilter, VariantListPriceFilter
The ListPrice filter specifies a value range and a currency for a product's ListPrice
that products or variants must match.
This is useful, among other things, for creating recommendations that only show products of a certain price, such as items that are just expensive enough to trigger a user's "free shipping" requirements.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductListPriceFilter, Relewise.Client",
"Range": {
"LowerBoundInclusive": 10.0,
"UpperBoundInclusive": 30.0
},
"Currency": {
"Value": "eur"
},
"TypeName": "ProductListPriceFilter",
"Negated": false
}
SalesPriceFilter
ProductSalesPriceFilter, VariantSalesPriceFilter
The SalesPrice filter specifies a value range and a currency for a product's SalesPrice
that products or variants must match.
This is useful, among other things, for creating recommendations that only show products of a certain price, such as items that are just expensive enough to trigger a user's "free shipping" requirements.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductSalesPriceFilter, Relewise.Client",
"Range": {
"LowerBoundInclusive": 10.0,
"UpperBoundInclusive": 30.0
},
"Currency": {
"Value": "eur"
},
"TypeName": "ProductSalesPriceFilter",
"Negated": false
}
ContentCategoryHasContentsFilter
The ContentCategoryHasContents Filter specifies that a content category must contain content entities to be returned. This can be negated in order to only return content categories that do not contain content entities.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ContentCategoryHasContentsFilter, Relewise.Client",
"TypeName": "ContentCategoryHasContentsFilter",
"Negated": false
}
OrFilter
The Or filter combines two sub-filters, and demand that either one or the other filter conditions must be true before the filter takes effect. This lets you combine to different conditions, for more advanced filter setups.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.OrFilter, Relewise.Client",
"Filters": [
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "inStock",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.EqualsCondition, Relewise.Client",
"Value": {
"Type": "Boolean",
"Value": true,
"IsCollection": false
},
"TypeName": "EqualsCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
},
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "stockCount",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.LessThanCondition, Relewise.Client",
"Value": 0.0,
"TypeName": "GreaterThanCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
}
],
"TypeName": "OrFilter",
"Negated": false
}
ProductCategoryHasProductsFilter
The ProductCategoryHasProducts Filter specifies that a product category must contain product entities to be returned. This can be negated in order to only return product categories that do not contain product entities.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasProductsFilter, Relewise.Client",
"TypeName": "ProductCategoryHasProductsFilter",
"Negated": false
}
ProductDisplayNameFilter
The ProductDisplayName filter ensures that product display names must match one or more value conditions to be returned.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDisplayNameFilter, Relewise.Client",
"Language": {
"Value": "en"
},
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.ContainsCondition, Relewise.Client",
"Value": {
"Type": "String",
"Value": "dog",
"IsCollection": false
},
"ValueCollectionEvaluationMode": "All",
"TypeName": "ContainsCondition",
"Negated": false
}
]
},
"MustMatchAllConditions": true,
"TypeName": "ProductDisplayNameFilter",
"Negated": false
}
ProductHasVariantsFilter
The ProductHasVariants filter specifies that products must have variant(s) associated with it to be returned in the query. The filter takes a LowerBoundInclusive
and UpperBoundInclusive
value to define the range of variants that a product must have to be returned.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductHasVariantsFilter, Relewise.Client",
"NumberOfVariants": {
"LowerBoundInclusive": 1,
"UpperBoundInclusive": 5
},
"IncludeDisabled": false,
"TypeName": "ProductHasVariantsFilter",
"Negated": false
}
ProductInCartFilter
The ProductInCart filter specifies that the products returned in the query must match the products in the Cart associated with the User used in the query.
This can usefully be negated to exclude products that are already in a user's cart when showing a recommendations on the Checkout page.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductInCartFilter, Relewise.Client",
"TypeName": "ProductInCartFilter",
"Negated": true
}
ProductRecentlyPurchasedByUserFilter
The ProductRecentlyPurchasedByUser filter is used to specify that an entity must have been purchased by the user within a specified time frame. This can be specified either as a specific timestamp with SinceUtc
, or as a SinceMinutesAgo
value that looks back at the last X minutes of the user's activity.
Usecase Example
Using UTC Timestamp
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyPurchasedByUserFilter, Relewise.Client",
"SinceUtc": "2025-01-01T00:00:00+01:00",
"TypeName": "ProductRecentlyPurchasedByUserFilter",
"Negated": false
}
Using SinceMinutesAgo
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyPurchasedByUserFilter, Relewise.Client",
"SinceMinutesAgo": 10080,
"TypeName": "ProductRecentlyPurchasedByUserFilter",
"Negated": false
}
VariantSpecificationFilter
The VariantSpecification filter specifies that a variant must have a certain Specification with a certain value in order to be returned in the query.
Usecase Example
json
{
"$type": "Relewise.Client.Requests.Filters.VariantSpecificationFilter, Relewise.Client",
"Key": "material",
"FilterOutIfKeyIsNotFound": true,
"EqualTo": "leather",
"TypeName": "VariantSpecificationFilter",
"Negated": false
}