on 10-01-2014 6:26 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.