cancel
Showing results for 
Search instead for 
Did you mean: 

Facet Value Sorting

Former Member
0 Kudos

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: https://download.hybris.com/api/5.1.1/commercesuite/apidocs/index.html). 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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I solved this by using an item code as the indexed field value. Then a Custom Sort Provider to return a precedence of the item with that code, and a Custom Display Name Provider to return human readable and localized names for each item/facet.

Former Member
0 Kudos

The sort field seems completely inaccessible, maybe its just used in sorting results?

Answers (0)