Product schema
Algolia’s commercetools integration stores your product data in an extensible format that’s optimal for search.
The product variant schema
Algolia stores commercetools product variants in the following format:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
// Unique ID in the format product ID.variantID
objectID: "ffdcbccd-fd9d-49fc-8f12-b43a97721300.7",
productID,
sku,
productType,
name, // Name of the product
description,
slug: { // Localized slugs (keys are locales and values are slugs)
en: "en-slug"
},
categories: { // Localized hierarchical categories for faceting
en: {
lvl0: ["Men"],
lvl1: ["Men > Clothing"],
lvl2: ["Men > Clothing > T-shirts"]
}
},
searchableAttributes: {
color: "blue"
},
attributes: {
color: "blue"
season: "winter"
},
images: [], // List of image URLs
prices: { // Prices by currency
USD: {
"min": 1000,
"max": 2000,
customerGroups
}
},
isMasterVariant, // `true` if this record is the primary variant
isInStock, // `true` if this SKU is in stock
categoryPageID: [ // Category pages
"Men",
"Men > Clothing",
"Men > Clothing > T-shirts"
]
}
The attributes
field lists all the commercetools product attributes.
Attributes used for search
By default, users can search in the following attributes, ranked in order of importance:
name
description
searchableAttributes
. All commercetools product attributes where theisSearchable
property istrue
. It’s a subset of theattributes
object in the product schema.categories
Display results grouped by product ID
You can group product variants in the results. For example, when displaying the results in your storefront, you could group multiple colors (variants) of the same t-shirt (product) together.
To group variants, apply Algolia’s distinct feature to the product ID.
If you don’t group variants (default behavior), the results show each variant separately.
Categories
Categories are stored as hierarchical facets.
Category pages are automatically generated and referenced by the categoryPageId
attribute.
Changes to your commercetools inventory
Algolia’s commercetools integration monitors inventory changes and sets the isInStock
value for each affected SKU.
isInStock
is true
if the inventory for any supply channel is greater than zero for that SKU.
Prices
The prices
attribute consists of key-value pairs with currency codes as keys, such as “USD”.
Values contain:
- The minimum price
min
incentAmount
: the smallest unit of the currency such as cents, pence, or centime. - The maximum price
max
incentAmount
- A list of customer groups to which the prices apply.