Consider 5 hits that represent 2 products with some variations.
[
{
"title": "Product A",
"variation": "Size: 1",
"price": 55,
"popularity": 11
},
{
"title": "Product A",
"variation": "Size: 2",
"price": 60,
"popularity": 21
},
{
"title": "Product B",
"variation": "Size: 1",
"price": 70,
"popularity": 4
},
{
"title": "Product B",
"variation": "Size: 2",
"price": 80,
"popularity": 61
},
{
"title": "Product B",
"variation": "Size: 3",
"price": 90,
"popularity": 4
}
]
If you perform a search with distinct=1 and attributeForDistinct=title and also have rankingAndSorting with a popularity as a custom ranking attribute you should get the following result.
[
{
"title": "Product B",
"variation": "Size: 2",
"price": 80,
"popularity": 61
},
{
"title": "Product A",
"variation": "Size: 2",
"price": 60,
"popularity": 21
}
]
What if I wanted to show the lowest price for these results (to show “costs from £70” wrt product B). However I don’t want to alter to overall order as Product B should be ranked above Product A based on the popularity. If I sorted by price it would select the hit with minimum price but the order would be incorrect. I am unable to add an attribute that would list the min price for a selected group within each individual hit as this search also needs to work if for example someone filtered out Size 1. Is there currently a way to sort which individual hit is selected to be shown as part of a distinct search?