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 API Reference.
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 demands that both filter conditions be true before the filter takes effect. This lets you combine two different conditions for more advanced filter setups.
Use case 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
}This filter demands that products be `InStock = True`, and that they belong to the category `category-1` in order to be returned.
AssortmentFilter
BrandAssortmentFilter, ContentCategoryAssortmentFilter, ContentAssortmentFilter, ProductCategoryAssortmentFilter, ProductAssortmentFilter, VariantAssortmentFilter
The Assortment filters are used to define if an entity belongs to a specific assortment.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductAssortmentFilter, Relewise.Client",
"Assortments": [
1
],
"TypeName": "ProductAssortmentFilter",
"Negated": false
}This filter demands that only products belonging to assortment `1` may be returned.
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 use cases might be excluding entities that are not available yet, or ensuring entities have a specific tag.
Use case 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
}This filter demands that the data contained within datakey `tags` on a product must contain `toast` in order to be returned.
DataHasKeyFilter
BrandDataHasKeyFilter, ContentCategoryDataHasKeyFilter, ContentDataHasKeyFilter, ProductCategoryHasDataKeyFilter, ProductDataHasKeyFilter, VariantDataHasKeyFilter
This filter evaluates whether a specific key exists on an entity or not.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDataHasKeyFilter, Relewise.Client",
"Key": "datakeyName",
"TypeName": "ProductDataHasKeyFilter",
"Negated": false
}This filter demands that the datakey `datakeyName` must exist on the entity.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductDisabledFilter, Relewise.Client",
"TypeName": "ProductDisabledFilter",
"Negated": false
}This filter demands that products being returned are not disabled.
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 use cases 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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductIdFilter, Relewise.Client",
"ProductIds": [
"prod-1",
"prod-2",
"prod-4"
],
"TypeName": "ProductIdFilter",
"Negated": false
}This filter demands that results returned match one of the listed Product IDs,
`Prod-1`, `Prod-2`, or `Prod-4`.
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 within the same category path as the specified category.
Read more about Category Scopes here.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasAncestorFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasAncestorFilter",
"Negated": false
}This filter demands that the only product categories that may be returned in the query are those that have either the category `cat-1`, `cat-2`, or `cat-3` somewhere above them in a category path.
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 a category path.
Read more about Category Scopes here.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasChildFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasChildFilter",
"Negated": false
}This filter demands that the only product categories that may be returned in the query are those that have either the category `cat-1`, `cat-2`, or `cat-3` directly below them in a category path.
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 a category path.
Read more about Category Scopes here.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasParentFilter, Relewise.Client",
"CategoryIds": [
"cat-1",
"cat-2",
"cat-3"
],
"TypeName": "ProductCategoryHasParentFilter",
"Negated": false
}This filter demands that the only product categories that may be returned in the query are those that have either the category `cat-1`, `cat-2`, or `cat-3` directly above them in a category path.
CategoryLevelFilter
ContentCategoryLevelFilter, ProductCategoryLevelFilter
The CategoryLevel filter is used to specify that a category entity must exist at a certain level or levels of a category path. For instance, if a product category has two categories above it in a category path, it exists at category level 3.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryLevelFilter, Relewise.Client",
"Levels": [
1,
2
],
"TypeName": "ProductCategoryLevelFilter",
"Negated": false
}This filter demands that the product categories being returned must be at either level 1 or level 2 of a category path.
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.
Use case 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
}This filter demands that only products that have been viewed by the user since January 1st 2025 may be returned.
Using SinceMinutesAgo
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyViewedByUserFilter, Relewise.Client",
"SinceMinutesAgo": 10080,
"TypeName": "ProductRecentlyViewedByUserFilter",
"Negated": false
}This filter demands that only products that have been viewed by the user within the last 10080 minutes (7 days) may be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductHasCategoriesFilter, Relewise.Client",
"TypeName": "ProductHasCategoriesFilter",
"Negated": false
}This filter demands that any products returned in the query must have at least one category associated with it.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductListPriceFilter, Relewise.Client",
"Range": {
"LowerBoundInclusive": 10.0,
"UpperBoundInclusive": 30.0
},
"Currency": {
"Value": "eur"
},
"TypeName": "ProductListPriceFilter",
"Negated": false
}This filter demands that products must have a ListPrice between `10` and `30` Euro in order to be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductSalesPriceFilter, Relewise.Client",
"Range": {
"LowerBoundInclusive": 10.0,
"UpperBoundInclusive": 30.0
},
"Currency": {
"Value": "eur"
},
"TypeName": "ProductSalesPriceFilter",
"Negated": false
}This filter demands that products must have a SalesPrice between `10` and `30` Euro in order to be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ContentCategoryHasContentsFilter, Relewise.Client",
"TypeName": "ContentCategoryHasContentsFilter",
"Negated": false
}This filter demands that content categories must contain content entities to be returned.
OrFilter
The Or filter combines two sub-filters and demands that either filter condition be true before the filter takes effect. This lets you combine two different conditions for more advanced filter setups.
Use case 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
}This filter demands that the products returned must either have the datakey `inStock` set to `True`, or have the datakey `stockCount` at a value greater than `0`
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductCategoryHasProductsFilter, Relewise.Client",
"TypeName": "ProductCategoryHasProductsFilter",
"Negated": false
}This filter demands that product categories must contain product entities to be returned.
ProductDisplayNameFilter
The ProductDisplayName filter ensures that product display names must match one or more value conditions to be returned.
Use case 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
}This filter demands that products must contain the string `dog` somewhere in the display name to be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductHasVariantsFilter, Relewise.Client",
"NumberOfVariants": {
"LowerBoundInclusive": 1,
"UpperBoundInclusive": 5
},
"IncludeDisabled": false,
"TypeName": "ProductHasVariantsFilter",
"Negated": false
}This filter demands that only products with between 1 and 5 variants may be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductInCartFilter, Relewise.Client",
"TypeName": "ProductInCartFilter",
"Negated": true
}This filter demands that only products that do not already exist within the User's Cart may be returned. Note the `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.
Use case 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
}This filter demands that only products that have been viewed by the user since January 1st 2025 may be returned.
Using SinceMinutesAgo
json
{
"$type": "Relewise.Client.Requests.Filters.ProductRecentlyPurchasedByUserFilter, Relewise.Client",
"SinceMinutesAgo": 10080,
"TypeName": "ProductRecentlyPurchasedByUserFilter",
"Negated": false
}This filter demands that only products that have been viewed by the user within the last 10080 minutes (7 days) may be returned.
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.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.VariantSpecificationFilter, Relewise.Client",
"Key": "material",
"FilterOutIfKeyIsNotFound": true,
"EqualTo": "leather",
"TypeName": "VariantSpecificationFilter",
"Negated": false
}This filter demands that variants must include the specification `material`, and that the value of this specification must equal `leather` to be returned.
ProductEngagementFilter
The ProductEngagementFilter filter specifies that a product must have a certain User Engagement with a specific sentiment in order to be returned in the query.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ProductEngagementFilter, Relewise.Client",
"IsFavorite": true,
"TypeName": "ProductEngagementFilter",
"Negated": false
}This filter demands that products must be marked as favorite in order to be returned.
VariantEngagementFilter
The VariantEngagementFilter filter specifies that a variant must have a certain User Engagement with a specific sentiment in order to be returned in the query.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.VariantEngagementFilter, Relewise.Client",
"Sentiment": "Like",
"TypeName": "VariantEngagementFilter",
"Negated": false
}This filter demands that variants must be marked with a "Like" sentiment in order to be returned.
ContentEngagementFilter
The ContentEngagementFilter filter specifies that a Content entity must have a certain User Engagement with a certain sentiment in order to be returned in the query.
Use case Example
json
{
"$type": "Relewise.Client.Requests.Filters.ContentEngagementFilter, Relewise.Client",
"Sentiment": "Dislike",
"TypeName": "ContentEngagementFilter",
"Negated": true
}This filter demands that content marked with "Dislike" sentiment are not to be returned.