Skip to Content
Former Member
May 13, 2015 at 02:43 PM

Product Grouping in Solr Throws java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String



I am trying to implement Solr Grouping as below:

     target.getSearchQuery().addSolrParams("group", "true");
     target.getSearchQuery().addSolrParams("group.field", "baseProductColourGroup_string");
     target.getSearchQuery().addSolrParams("group.truncate", "true");
     target.getSearchQuery().addSolrParams("group.main", "true");
     target.getSearchQuery().addSolrParams("group.format", "simple");
     target.getSearchQuery().addSolrParams("group.ngroups", "true");
     target.getSearchQuery().addSolrParams("group.limit", "1");

I have a flat variant structure,

One base Products

Multiple variants with colour and size at same level. Red colour , Small Size is one variant. Red colour, Medium Size is another variant.

When I group by baseProductColourGroup_string, the solr Document looks good , but I have the above exception.

link text

Implemented following: • Customize search. Create an interface that extends "ProductSearchFacade" . • Create a class that implements MyProductSearchFacade interface. • Create an interface that extends MOSProductSearchService and also write an implementation class for the interface. • Create a Solr Query Populator to pass query parameters. • Create a class that extends SearchResultProductConverter and override the below method  public void populate(final SearchResultValueData source, final MyProductData target) { } Implementation: public class MOSSearchResultProductConverter extends AbstractPopulatingConverter { public void populate(final SearchResultValueData source, final MyProductData target) { //populate attributes. } } • Now from categorypageController /searchPageController, invoke methods of the above facades and services. • Provide boosting for Price and Stock, mark the boost attribute of solr config. This throws error.

Please help.


2973-exception.txt (10.3 kB)