Skip to Content
Former Member
Oct 01, 2014 at 05:26 PM

Facet Value Sorting


I'm trying to sort the facets based on a precedence attribute set on item that defines the facet value on the product (i.e. a size of extra large may have a precedence of 1 where extra small has a precedence of 6) I am able to set a sortable field in solr using:

 final String indexFieldNames = getFieldNameProvider().getFieldName(indexedProperty, null, FieldNameProvider.FieldType.INDEX);
 final String sortFieldNames = getFieldNameProvider().getFieldName(indexedProperty, null, FieldNameProvider.FieldType.SORT);

however the sort field seems to be inaccessible in any of the default sort providers in hybris as well as in a custom comparator following this tutorial: Customized Sort Providers. The comparator takes FacetValue's which have no sort field, and only seems to contain the index field. (documentation here: How do I use the sort field in a customized sort provider or is there a better way to separate the sorting for facets from their name. It seems the only sort facets is to directly compare attributes of the FacetValue class can I extend this class in any useful way and use and customized FacetValue? Thanks -Ryan