Skip to Content
Former Member
Apr 25, 2016 at 11:56 AM

How to group variants using Solr ?


Hi experts,

We customised Solr to index variants, the requirement is to group variants by the root product code (with "rootProductCodeValueProvider”) and display the main variant in first position.

For example I have Flash disk as base product and its variants are :

  • Flash disk White 16Go

  • Flash disk Gold 16Go

  • Flash disk Black 16Go

I need to display this group on the PLP regardless of the criteria used by Solr to sort products and display the "Flash disk White 16Go” in first position because it has mainVariantProduct = true

I added an attribute “baseProduct” to the Solr impex and the adequate provider “rootProductCodeValueProvider", this attribute will be used by Solr to group variants product. I used the HMC to add this group field name. alt text

When I did that, I got just one search result when searching instead of all variants. Please could you help me to resolve this issue. Thank you.