Product projections can be retrieved using full-text search, filtering, and faceting.
Standalone ProductPriceMode might yield inconsistent results.SameForAll constraint.Specifically, this means you cannot:
- Receive tailored product data in returned search results.
- Use tailored data in full text search.
- Use tailored data in filters, facets or for sorting.
storeProjection parameter instead.Activate the Product Projection Search API
To activate Product Projection Search for your Project, choose one of the following options:
- using the Merchant Center by navigating to Settings > Project settings > Storefront Search.
- using the Change Product Search Indexing Enabled update action with
mode: ProductProjectionsSearchon the Update Project endpoint.
{
"action": "changeProductSearchIndexingEnabled",
"enabled": true,
"mode": "ProductProjectionsSearch"
}
Automatic deactivation
The Product Projection Search API and the Search Term Suggestions API are automatically deactivated for a Project if there have been no calls to them for the duration of 30 consecutive days. The APIs can be reactivated again as described above.
Product Projection Search
with GET
view_products:{projectKey}view_published_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
markMatchingVariantsBoolean | Set to true to mark matching variants in the search result.Default: false |
text.<locale>String | The text to analyze and search for, for example as supplied by a user through a search input field.
The parameter must include the language in form of a Locale.
The content to search in, that means the full-text search, is only performed in the localized Product content of the specified language. The parameter can be passed multiple times. |
fuzzyBoolean | Default: false |
fuzzyLevelInt | Set this parameter to overwrite the default fuzzy level.
Only applicable if
fuzzy is true.
If the provided value exceeds the default value, the API responds with an InvalidInput error. Minimum: 0Maximum: 2 |
filter.queryString | Applies a filter to the query results before facets are calculated.
This parameter has an impact on facet counts.
If you don't use the facet parameter in the same request, use this parameter instead of filter.The parameter can be passed multiple times. |
filterString | Applies a filter to the query results after facets are calculated.
This parameter does not have an impact on facet counts.
Use this parameter in combination with the facet and filter.facets parameters for multi-select faceting.The parameter can be passed multiple times. |
facetString | Requests calculation of facets. The parameter can be passed multiple times. |
filter.facetsString | Applies a filter to the calculated facet results, not to the Products returned with the query results.
A facet's own aggregation is not filtered by its corresponding filter.facets criteria.
Use this parameter in combination with the facet and filter parameters for multi-select faceting.The parameter can be passed multiple times. |
sortString | Controls sorting of results.
Use this parameter multiple times to sort by multiple fields.
The parameter can be passed multiple times. |
expandString | Enables server-side expansion of References. For details, see Reference Expansion. The parameter can be passed multiple times. |
limitInt | The maximum number of results returned on a page. Default: 20Minimum: 0Maximum: 500 |
offsetInt | The starting point for retrieving paginated results. Default: 0Minimum: 0Maximum: 10000 |
stagedBoolean | Whether to search in the current or staged Product Projections. For API Clients with the view_published_products, but not the view_products OAuth scope, true leads to a 403 Forbidden error.Default: false |
priceCurrency | Enables Product price selection and Scoped Price Search. Pattern: ^[A-Z]{3}$ |
priceCountry | Enables Product price selection and Scoped Price Search.
It can be used only in conjunction with the priceCurrency parameter.Pattern: ^[A-Z]{2}$ |
priceCustomerGroupString | id of an existing CustomerGroup used for Product price selection.
It can be used only in conjunction with the priceCurrency parameter. |
priceCustomerGroupAssignmentsString | IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups.
It can be used only in conjunction with the priceCurrency parameter.The parameter can be passed multiple times. |
priceChannelString | id of an existing Channel used for Product price selection.
It can be used only in conjunction with the priceCurrency parameter. |
priceRecurrencePolicyString | id of an existing RecurrencePolicy used for Product price selection.
It can be used only in conjunction with the priceCurrency parameter. |
localeProjection | Use for locale-based projection. The parameter can be passed multiple times. |
storeProjectionString | key of an existing Store.
If the Store has defined languages, countries, distributionChannels, or supplyChannels,
they are used for projections based on locale, price,
and inventory.If Product Selections are used, the API does not take the availability of the Product in the specified Store into account.
Product Tailoring modifies the product information returned in API responses. However, you can only specify Query Predicates for the original Product data, not for the tailored data. |
ProductProjectionPagedSearchResponse
asapplication/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/product-projections/search -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"offset": 0,
"count": 2,
"total": 2,
"limit": 0,
"results": [
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6"
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {
},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": []
},
{
"id": "e779ec1a-0a98-4135-8344-d51bdafd4fe6",
"version": 6,
"productType": {
"typeId": "product-type",
"id": "bac5ef74-e0f9-4792-8439-ab84b270599e"
},
"name": {
"en": "product with dates"
},
"description": {
"en": "<p>Used to test the various date attributes<br></p>"
},
"categories": [],
"slug": {
"aa": "product-with-dates-1432797256269",
"de": "product-with-dates-1432797256269",
"en": "product-with-dates-1432797256269"
},
"masterVariant": {
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "aboolean",
"value": true
}
]
},
"variants": [],
"searchKeywords": {
},
"hasStagedChanges": true,
"published": true,
"createdAt": "2015-05-28T07:15:48.738Z",
"lastModifiedAt": "2015-05-28T07:19:38.624Z",
"attributes": []
}
],
"facets": {
"red-things": {
"type": "filter",
"count": 0
},
"variants.attributes.size": {
"type": "terms",
"dataType": "text",
"missing": 0,
"total": 2,
"other": 0,
"terms": [
{
"term": "40",
"count": 2
},
{
"term": "41",
"count": 2
}
]
},
"variants.attributes.price": {
"type": "range",
"ranges": [
{
"from": 0,
"fromStr": "0",
"to": 100,
"toStr": "100",
"count": 2,
"total": 2,
"min": 0,
"max": 100,
"mean": 50.5
}
]
}
}
}with POST
view_products:{projectKey}view_published_products:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
application/x-www-form-urlencodedProductProjectionPagedSearchResponse
asapplication/jsonSearch response
limitInt | The maximum number of results returned on a page. Default: 20Minimum: 0Maximum: 500 |
offsetInt | The starting point for the retrieved paginated result. Default: 0Minimum: 0Maximum: 10000 |
countInt | Actual number of results returned. |
totalInt | Total number of results matching the query. |
resultsArray of ProductProjection | ProductProjections where at least one ProductVariant matches the search query, provided with the text.{language} and/or filter.query or filter query parameter.
If the query parameter markMatchingVariants=true was provided with the request, the matching variants are marked as such. |
facets | Facet results for each facet expression specified in the search request.
Only present if at least one facet parameter was provided with the search request. |
Query results
results array contains Product Projections where at least one ProductVariant matches the full-text search query or the provided filter expression.markMatchingVariants=true to mark the matching variants.Facet results
facets object of the query result. The corresponding results for term, range, and filtered facets are term facet result, range facet result, and filtered facet result respectively.variants.attributes.color:red as red-things
variants.attributes.size:"m"
{
"offset": 0,
"count": 0,
"results": [],
"facets": {
"red-things": {
"type": "filter",
"count": 0
},
"variants.attributes.size": {
"type": "filter",
"count": 0
}
}
}
Term facet result
typeFacetTypes | terms |
dataType | Data type to which the facet is applied. |
missingInt | Number of ProductVariants that have no value for the specified term facet expression. |
totalInt | Number of terms matching the term facet expression.
|
otherInt | Number of terms not represented in this object (such as the number of terms beyond the limit). |
termsArray of FacetTerm | Values for the field specified in term facet expression for which at least one ProductVariant could be found.
By default, facet terms are returned in a descending order of their
MaxItems: count.200 |
TermFacetResultType
Data type to which the facet is applied.
text- For AttributeTextType Attributes.
date- For AttributeDateType Attributes.
time- For AttributeTimeType Attributes.
datetime- For AttributeDateTimeType Attributes.
boolean- For AttributeBooleanType Attributes.
number- For AttributeNumberType Attributes.
FacetTerm
termAny | Value for the field specified in the term facet expression for which at least one ProductVariant could be found. |
countInt | Number of ProductVariants for which the term applies. |
productCountInt |
Range facet result
typeFacetTypes | range |
rangesArray of FacetRange | Statistical data over values for date, time, datetime, number, and money type fields. |
FacetRange
fromFloat | The range's lower endpoint. 0 represents -∞. |
fromStrString | The range's lower endpoint. An empty string represents -∞. |
toFloat | The range's upper endpoint. 0 represents +∞. |
toStrString | The range's upper endpoint. An empty string represents +∞. |
countInt | Number of ProductVariants for which the values in a field fall into the specified range. |
productCountInt | |
totalFloat | Sum of all values contained in the range. |
minFloat | Minimum value within the range. |
maxFloat | Maximum value within the range. |
meanFloat | Arithmetic mean of the values within the range. |
Filtered facet result
typeFacetTypes | filter |
countInt | Number of ProductVariants matching the value specified in filtered facet expression. |
productCountInt | Number of Products matching the value specified in filtered facet expression.
Present only if the counting products extension is enabled. |
Matching variants
categories, key, slug), all variants of the Product Projections returned in the search response match the filter by default.variants.attributes.{name}, variants.prices.centAmount), the filter may match only for certain Product Variants.markMatchingVariants to true in the Product Projection Search request.isMatchingVariant field indicating which Product Variant matches the query.- If
isMatchingVariant: true, the Product Variant matches the search query. - If
isMatchingVariant: false, the Product Variant does not match the search query, but is returned as part of the returned Product Projection.
markMatchingVariants is set to false in the Product Projection Search request, the Product Variants returned in the Product Projection Search response will not contain the isMatchingVariant field.Full-text search
text.{language} query parameter performs a full-text search on the ProductProjections data.
For localized fields, the API only searches text matching the language specified in the text.{language} query parameter.256 characters provided with the text.{language} query parameter, and characters beyond this limit are ignored. The API will not return an error when you pass longer values for this query parameter.Searchable fields
name(weighed heavier than the other searchable fields)descriptionslugskusearchKeywords
metaKeywords and metaTitle are not indexed for full-text search.isSearchable is set to true:- Text type Attributes
- Localizable text type Attributes
- Money type Attributes
- The
labelproperty of each enum value in an enum type Attribute. - The
labelproperty of each localized enum value in a localized enum type Attribute. - AttributesReferenceType: Attributes are not full-text searchable, but are available for filtering.
sort query parameter is given in the Product Projection Search request, the results are sorted by the relevance of the Product to the search text passed.Fuzzy search
fuzzy query parameter in the Product Projection Search request to true, the API will return ProductProjections that contain slight differences from the search text.
For example, a fuzzy search for "whisky" will also return Products that are labeled with "whiskey."To optimize the discovery of related terms, the API dynamically adapts the level of fuzziness applied on the text based on the length of the text to analyze.
0- fortextof one or two characters.1- fortextof three, four or five characters.2- fortextof more than five characters.
fuzzyLevel query parameter.
However, the value must not exceed the default value, which is selected dynamically based on the length of the text value.Filters
Filter parameters
- The
filter.queryparameter filters Products in the query results before calculating facets. - The
filterparameter filters Products in the query results after calculating facets. - The
filter.facetsparameter modifies the aggregated facet counts in the facet results, not the Products returned with the query results.
A facet's own aggregation is not filtered by its correspondingfilter.facetscriteria.
For example, if you're requesting two facets—one for color and another for size—and you applyfilter.facetsfor color, the facet aggregation for size will be filtered accordingly, but the facet counts for color itself will remain unaffected.
This allows for multi-select faceting in combination with thefilterparameter, where storefront users can refine search results across multiple facet values without limiting the overall query results.
Filter expressions
You can specify filters with filter expressions made of searchable fields, filter operators, and values to search for.
Matching value
field:{value} search for a specified value for the given field.
The value must match exactly.
If you want fuzzy search for text values, use full-text search instead.Matching values
OR operator).
For example, the below search request filters Products of the color "black" OR "grey":GET /{projectKey}/product-projections/search?filter%3Dvariants.attributes.color.key%3A%22black%22%2C%22grey%22
Within range of values
:range ({from} to {to})You can specify multiple ranges for the same filter by separating the ranges by commas:
:range ({from} to {to}), ({from} to {to})* to ignore the lower- or upper-bound values: :range (* to {to})Check if value exists
{field}:exists."") are recognized as existing values and are caught by this filter.Check if value is missing
{field}:missing."") are not recognized as missing values and are not caught by this filter.Combine filters with logical AND
filter parameters in one search request.
This combines them with an AND operator.
For example, the below search request filters Products of a certain Category AND of the color "black":GET /{projectKey}/product-projections/search?filter%3Dcategories.id%3A%22{category-ID}%22%26filter%3Dvariants.attributes.color%3A%22black%22
Field-specific filters
This section describes the searchable fields on Products and Product Variants for which you can set filters.
Filter by Category
The following filters can be applied:
-
categories.id:"{id}"filters Products that belong to the specified Category. -
categories:missingfilters Products that are not assigned to any Category.Empty strings ("") are not recognized as a missing value and are not caught by this filter. -
categories:existsfilters Products that are assigned to at least one Category.
filter, filter.query, and filter.facets parameters.Filter by Category subtrees
The following filters can be applied:
categories.id: subtree("{id}")filters Products that belong to the specified Category or any of its descendant Categories.categories.id: subtree("{id}"), subtree("{id2}")filters Products that belong to different branches of the Category tree.
Othersubtreefunctions can be added to the filter. Each subtree specifies the Category of the other branch in the Category tree.
subtree function can also be used in combination with several regular ID filters: categories.id: subtree("{id1}"), "{id2}", "{id3}". If the Categories are children of {id1}, it is not necessary to specify {id2} and {id3}.subtree function can be applied in filter.facets.Filter by Price
The following filters can be applied:
-
variants.price.centAmount:{amount}filters Products whose Embedded Price matches the specified value. -
variants.price.centAmount:range ({from} to {to}), ({from} to {to}), ...filters Products whose Embedded Price matches the specified range that includes the lower- and upper-bound values. -
variants.price.centAmount:range (* to {to})filters Products whose Embedded Price matches the specified range that includes the lower- and upper-bound values.
Using*ignores the lower- or upper-bound values. -
variants.prices:missingfilters Products that contain a ProductVariant without any Embedded Price set.Empty strings ("") are not recognized as a missing value and are not caught by this filter. -
variants.prices:existsfilters Products that contain a ProductVariant with at least one Embedded Price set.
filter, filter.query, and filter.facets parameters.Filter by Scoped Price
scopedPrice field with the ScopedPrice. You can apply filters on the scopedPrice field and its subfields like value and currentValue as described in this section.filter, filter.query, and filter.facets parameters.Filter by ScopedPrice value
For example:
variants.scopedPrice.value.centAmount:range (* to 1200).Filter by ScopedPrice currentValue
For example:
variants.scopedPrice.currentValue.centAmount:1000.Filter by ScopedPrice discounted value
discounted value is available.For example:
variants.scopedPrice.discounted.value.centAmount:range (* to 1200).Filter by scopedPriceDiscounted
scopedPriceDiscounted. The value would be true if a ProductDiscount is applied on the Embedded Price.Filter by SKU
The following filters can be applied:
-
Empty strings (
"") are not recognized as a missing value and are not caught by this filter.
filter and filter.query parameters.Filter by Product Key
The following filters can be applied:
-
Empty strings (
"") are not recognized as a missing value and are not caught by this filter.
Filter by ProductVariant Key
The following filters can be applied:
-
Empty strings (
"") are not recognized as a missing value and are not caught by this filter.
Filter by ProductType
productType.id:{id} filters Products that matches the specified ProductType.filter and filter.query parameters.Filter by TaxCategory
The following filters can be applied:
-
taxCategory.id:{id}filters Products that match the specified TaxCategory. -
taxCategory:missingfilters Products that do not belong to any TaxCategory.Empty strings ("") are not recognized as a missing value and are not caught by this filter. -
taxCategory:existsfilters Products that have a TaxCategory set.
filter and filter.query parameters.Filter by State
The following filters can be applied:
-
state.id:{id}filters Products that match the specified State. -
state:missingfilters Products that do not belong to any State.Empty strings ("") are not recognized as a missing value and are not caught by this filter. -
state:existsfilters Products that have a State set.
filter and filter.query parameters.Filter by reviewRatingStatistics
The following filters can be applied:
reviewRatingStatistics.averageRating:{value}filters Products that have the average ReviewRatingStatistics matching the specified value.reviewRatingStatistics.averageRating:range ({from} to {to}), ({from} to {to}), ...filters Products that have the average ReviewRatingStatistics matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values.reviewRatingStatistics.highestRating:{value}filters Products that have the highest ReviewRatingStatistics matching the specified value.reviewRatingStatistics.highestRating:range ({from} to {to}), ({from} to {to}), ...filters Products that have the highest ReviewRatingStatistics matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values.reviewRatingStatistics.lowestRating:{value}: filters Products that have the lowest ReviewRatingStatistics matching the specified value.reviewRatingStatistics.lowestRating:range ({from} to {to}), ({from} to {to}), ...: filters Products that have the lowest ReviewRatingStatistics matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values.reviewRatingStatistics.count:{value}filters Products that have a number of ReviewRatingStatistics matching the specified value.reviewRatingStatistics.count:range ({from} to {to}), ({from} to {to}), ...filters Products that have a number of ReviewRatingStatistics matching the specified range.
filter and filter.query parameters.Filter by Attribute values
isSearchable field set to true in its AttributeDefinition.The following filters can be applied:
-
variants.attributes.{name}:"{value}"filters ProductVariants with the Attribute matching the specified value. -
variants.attributes.{name}:range ({from} to {to}), ({from} to {to}), ...filters ProductVariants with the Attribute matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values. -
variants.attributes.{name}:missingfilters Products that do not have a Attribute set.Empty strings ("") are not recognized as a missing value and are not caught by this filter. -
variants.attributes.{name}:existsfilters Products that have a Attribute set. -
For AttributeEnumType Attributes, the filter must be applied to the
keyof the AttributePlainEnumValue.variants.attributes.{myEnumName}.key:"{value}"
-
For AttributeMoneyType Attributes, the filter must be applied to Money
centAmountorcurrencyCodeproperty.variants.attributes.{myMoneyAttribute}.centAmount:{value}variants.attributes.{myMoneyAttribute}.centAmount:range ({from} to {to}), ({from} to {to}), ...variants.attributes.{myMoneyAttribute}.currencyCode:"{value}"
-
For AttributeReferenceType Attributes, the filter must be applied to the
idor thetypeIdof Reference.variants.attributes.{myReferenceAttribute}.id:"{id}"variants.attributes.{myReferenceAttribute}.typeId:"{typeId}"
-
For AttributeSetType Attributes, the filter can be specified multiple times to search for a set that contains at least those values (
AND). Specifying multiple values, separated by a comma, will match if one of those values is present in the set (OR).
For example, the below search request filters Products of the color "green"AND"black"OR"grey":GET /{projectKey}/product-projections/search?filter%3Dvariants.attributes.colors%3A%22green%22%26filter%3Dvariants.attributes.colors%3A%22black%22%2C%22grey%22
filter, filter.query, and filter.facets parameters.Filter by Product Variant availability
The following filters can be applied:
variants.availability.isOnStock:truefilters ProductVariants with the availability matching the specified value.variants.availability.availableQuantity:range (1 to *)filters ProductVariants with the availability matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values.variants.availability.channels.<channel-id>.isOnStock:truefilters ProductVariants in a specific supply Channel with the availability matching the specified value.variants.availability.channels.<channel-id>.availableQuantity:range (1 to *)filters ProductVariants in a specific supply Channel with the availability matching the specified range that includes the lower- and upper-bound values. Using*ignores the lower- or upper-bound values.variants.availability.isOnStockInChannels:"channel-id-1","channel-id-2","channel-id-3"filters ProductVariants where ProductVariantAvailabilityisOnStockistruein at least one of the specified Channels.
Filter by Product searchKeywords
searchKeywords.{language}.text:"{value}" filters Products that matches the search keywords in a specified locale.Filter by DateTime
Filter by createdAt
createdAt:range ({from} to {to}) filters ProductVariants by the createdAt date in a specific date range. For example:GET /{projectKey}/product-projections/search?filter.query%3DcreatedAt%3Arange%20(%222015-06-04T12%3A27%3A55.344Z%22%20to%20%222016-06-04T12%3A27%3A55.344Z%22)
* ignores the lower- or upper-bound values.Filter by lastModifiedAt
lastModifiedAt:range ({from} to {to}) filters ProductVariants by the lastModifiedAt date in a specific date range.The search result includes the lower- and upper-bound values. Using
* ignores the lower- or upper-bound values.Facets
Facets calculate statistical counts to aid in faceted navigation. It answers questions like "how many t-shirts of size XL are there?" or "how many TVs are there that cost between US$500 and $600?"
facet query parameter in a Product Projection Search API call.
Each type of facet has its specific facet expression:- term facet expression for term facets,
- range facet expression for range facets, and
- filtered facet expression for filtered facets.
isSearchable field set to true in its AttributeDefinition.Term facets
This facet provides the counts for each of the different values the query parameter has. It is useful, for example, for obtaining all possible values of an Attribute to provide filters for those values on the frontend.
Term facet expression
categories.idcounts Product Variants of all Categories.
Other built-in fields can be requested analogously.
Attributes
variants.attributes.{name}counts Product Variants for all occurring values of custom simple value Attributes such astext,date,time,datetime,boolean, andnumber.variants.attributes.{name}.{lang}counts Product Variants for all occurring values of customltextAttributes in the given language.variants.attributes.{name}.keycounts Product Variants for all occurringenumorlenumAttribute keys.variants.attributes.{name}.labelcounts Product Variants for all occurringenumAttribute labels.variants.attributes.{name}.label.{lang}counts Product Variants for all occurringlenumAttribute labels in the given language.variants.attributes.{name}.centAmountcounts Product Variants for all occurring values of a custommoneyAttribute.variants.attributes.{name}.currencyCodecounts Product Variants for all occurring currency codes of a custommoneyAttribute.
GET /{projectKey}/product-projections/search?facet%3Dvariants.attributes.colors%26facet%3Dvariants.attributes.size%3A%22m%22
Availability
variants.availability.availableQuantitycounts Product Variants for all occurring available quantities.variants.availability.channels.<channel-id>.availableQuantitycounts Product Variants for all occurring available quantities for the supply Channel with ID<channel-id>.
Review ratings
reviewRatingStatistics.averageRatingcounts Product Variants for all occurring average ratings.reviewRatingStatistics.highestRatingcounts Product Variants for all occurring highest ratings.reviewRatingStatistics.lowestRatingcounts Product Variants for all occurring lowest ratings.reviewRatingStatistics.countcounts Product Variants for all occurring Review ratings counts.
Range facets
Range facet expression
range qualifier can be applied analogous to the filters with its lower- and upper-bounds:
:range ({from} to {to})You can specify multiple ranges for the same facet by separating the ranges by commas:
:range ({from} to {to}), ({from} to {to})* to ignore the lower- or upper-bound values: :range (* to {to}):range notation is applicable to the date, time, datetime, number, and money type fields. It is also applicable to a set of these types. If one matching element is contained in the set, all elements are used in the aggregation.Ranges of Prices
variants.price.centAmount:range
counts Product Variants whose Embedded Price falls in one of the specified ranges.
variants.price.centAmount:range (* to 50), (50 to 100), (100 to *)
Ranges of Scoped Price
variants.scopedPrice.currentValue.centAmount:range
counts Product Variants whose ScopedPricecurrentValuefalls in one of the specified ranges.
variants.scopedPrice.currentValue.centAmount:range (* to 1000), (1000 to 2000), (2000 to 3000)
Ranges of Money type Attributes
variants.attributes.{name}:range
counts Product Variants whose values of the Attribute fall in one of the specified ranges.
Filtered facets
Filtered facet expression
Categories
-
categories.id:"{id}"counts Product Variants in the specified Category. -
categories.id: subtree("{id}")counts Product Variants in the subtree of the specified Category. -
categories.id: subtree("{id1}"), subtree("{id2}")counts Product Variants for each of the specified subtrees.Unlike filters, facets usingsubtreecannot be mixed with regular value facets, socategories.id: subtree("{id}"), "{id2}"will ignore{id2}. -
categories.id: subtree("*"): The asterisk parameter is equivalent to counting the ProductVariants that have a Category assigned.
Prices
variants.price.centAmount:{amount}counts Product Variants that have the specified Embedded Price.
Attributes
variants.attributes.{name}:{value}counts Product Variants with the Attribute that match the specified value of a simple Attribute.String values must be set in quotation marks. Add the respective postfixes for other Attribute types analogous to when requesting facets for all values (see above).
variants.attributes.{name}:{value},{value2}counts Product Variants with the Attribute that match at least one of the values in the comma-separated list.variants.attributes.{myEnumName}.key:"{value}"counts the occurrences of a specific enum key.
Facet expression extensions
Alias
Examples:
variants.attributes.color.key:red as red_stuff
variants.attributes.brand:"Coca-Cola" as brand_coke
variants.attributes.brand:"Pepsi" as brand_pepsi
variants.price.centAmount:range(0 to 9999) as price_below_100
variants.price.centAmount
Counting Products
counting products to a facet expression.
The corresponding facet result then contains an additional field productCount that shows the number of Products.Examples:
-
variants.attributes.color.key counting productsreturns a term facet result for each FacetTerm (in this case for each color) containing:- the number of ProductVariants with that color.
- the number of Products having at least one ProductVariant with that color.
-
variants.price.centAmount:range (0 to 10000) counting productsreturns a range facet result for each FacetRange containing:- the number of ProductVariants having an Embedded Price in that FacetRange.
- the number of Products having at least one ProductVariant with an Embedded Price in that FacetRange.
-
variants.attributes.color.key:red counting productsreturns a filtered facet result containing:- the number of ProductVariants that are red.
- the number of Products having at least one red ProductVariant.
-
categories.id:"{id}" counting productsreturns a filtered facet result containing:- the number of Products in the specified Category.
- the sum of all ProductVariants of these Products.
Sorting
text (that is their "score"). An alternative sorting can be specified using the sort parameter with the structure {field} {direction}.
Compound sorting (also known as multi-sort) is applied when specifying multiple sort parameters ordered by priority with each parameter having its own sorting direction, ascending (asc) or descending (desc).sort parameters do not define an ordering, the position of some or all Products can be non-deterministic that is not predictable and repeatable across API requests.
Common cases are:- When neither
textnorsortis given, the complete order is non-deterministic. - When full text is provided but no
sortis given, the results are returned in a descending order of relevance. - When Products have no value set on the fields that are the sort criteria, the position is non-deterministic among those with no value set.
- When Products have identical vales on the fields that are the sort criteria, the position among each group with identical values is non-deterministic.
sort parameter at the end of the list of sort parameters that sorts by a field or attribute that has distinct values across all products. For example, createdAt or an Attribute specific for this purpose.The following are standard fields to sort by:
name.{language}
Sorts Products by their name.
The field must include the language in the form of a Locale.categoryOrderHints.{category ID}
Sorts Products by their CategoryOrderHint in combination with a filter by category.createdAt
Sorts Products by their creation date.lastModifiedAt
Sorts Products by their last modification date.id
Sorts Products by their ID.scoreSorts Products by the search relevance score.
Sorting byscorecan be combined with other sorting criteria. For example, sorting byscoreandidensures consistent order of Products across several search requests for Products that have the same relevance score.
name.de asc
Sort by Price
price sorts Products by their Embedded Price. Since Prices can vary across Variants of a Product, the highest Embedded Price is used for a descending sort direction, while the lowest Embedded Price is used for an ascending sort direction.centAmount of the first Embedded Price from the prices of every ProductVariant is used for sorting. If you have more than one Embedded Price defined per Product Variant, consider sorting by Scoped Price.Sort by Scoped Price
scopedPrice, use Scoped Price Search.variants.scopedPrice.value
Sorts Products by their ScopedPricevalue.variants.scopedPrice.currentValue
Sorts Products by their ScopedPricecurrentValue.
value or currentValue might return an unexpected result if you don't specify one of their subfields. For example, to sort by the numerical value of the Price, you must specify the .centAmount subfield as follows: variants.scopedPrice.currentValue.centAmount.Sort by Reviews
reviewRatingStatistics.averageRating
Sorts Products by their average rating.reviewRatingStatistics.highestRating
Sorts Products by their highest rating.reviewRatingStatistics.lowestRating
Sorts Products by their lowest rating.reviewRatingStatistics.count
Sorts Products by the number of ratings.
Sort by values found on ProductVariants
By default, the minimum value is used when sorting in ascending order (
asc.min) and the maximum value is used when sorting in descending order (desc.max). For a different sorting behavior, the parameters can be set to asc.max or desc.min respectively.variants..Sort by SKU
variants.sku sorts Products sorted alphabetically by their SKUs.Sort by availability
To sort products by availability:
variants.availability.restockableInDays
Sorts Products by number of days it takes to restock it (with no supply Channel).variants.availability.channels.<channel-id>.restockableInDays
Sorts Products by number of days it takes to restock it for a specific supply Channel.variants.availability.availableQuantity
Sorts Products by available quantity (with no supply Channel).variants.availability.channels.<channel-id>.availableQuantity
Sorts Products by available quantity for a specific supply Channel.
`variants.availability.availableQuantity desc.min`
Sort by Attributes
The following sort can be applied:
variants.attributes.{name}
Sorts Products by simple value Attributes such astext,date,time,datetime,boolean, andnumber.variants.attributes.{name}.{lang}
Sorts Products byltextAttribute in the specified language.variants.attributes.{name}.key
Sorts Products byenumorlenumAttribute key.variants.attributes.{name}.label
Sorts Products byenumAttribute label.variants.attributes.{name}.label.{lang}
Sorts Products bylenumAttribute label in the specified language.variants.attributes.{name}.centAmount
Sorts Products bymoneyAttribute amount.variants.attributes.{name}.currencyCode
Sorts Products bymoneyAttribute currency.
variants.attributes.color.label.en asc.max
Pagination
10 000 results by requesting them page by page.
The total field in a query result indicates how many results match the search query in total.Limit
limit parameter you can set the maximum number of results returned on a page.
Any value between 0 and 100 is allowed, the default limit is 20.
Set limit=0 if you want to retrieve facets only, but not the search result.Offset
offset parameter controls the starting point for retrieving paginated results.
With the default value 0 you retrieve the first page of query results.
Setting offset=1 skips the first page and returns the second page of results, and so on.
Each page contains a number of results defined by the limit parameter.offset is 10 000.Setting pagination parameters exceeding this limit will result in an error with the code "SearchExecutionFailure."