Variant
In the QSC console it is possible to configure the behaviour of variants.
- all variants are displayed in the search result as documents
- only the most recent variant is displayed in the search result
- the top n variants are returned as sub documents
Feeding
- feed every variant as a single document
- the variants are grouped by a variantFieldName, that contains a unique id for every variant
- every variant has the same id value
- variantFieldName must be a keyword field
- variants can be sorted by any indexed field - sometimes it is necessary to index a special field for sorting, e.g. a specified order in a CMS
Search Configuration
For the configuration of variants in the search special variables are used.
Required parameters
- variantId: variantFieldName - the
Optional parameters:
- variantSourceGroupField - the field wich is displayed in the API
- variantSize - number of returned variants in the result
- variantSort - json string that defines how the variants are sorted
Example Configuration:
key | value | comment |
---|---|---|
variantId | myVariantId | myVariantId is a unique id that correlate all variantes |
variantSourceGroupField | productVariants | this can be a complex object - TODO support mulitple fields |
variantSize | 12 | how many variants are returned |
variantSort | [ { "variantSort": "desc" } ] | how the variantes are sorted - this can be any indexed field |
BETA: Variants based on multiple fields
This feature is just in beta. The configuration is done with variables at the moment.
- configure a mapComplexVariantId variable in Feeding
"variables": {
"mapComplexVariantId": "variantId,attr_herstellerfarbe_txt",
}
- configure the variantId in search:
"variables": [
{
"key": "variantId",
"value": "complexVariantId"
}
],
This feature is used in the https://shop-waldlaeufer.de/ shop.
To disable variants in a POST request:
{
"result": {
"facet": {
"enabled": false
}
}
}