Search code examples
solrsap-commerce-cloud

what is the significance of sortPOS attribute in SolrSortFiled itemtype in Hybris


What is the usability of sortPOS attribute of SolrSortFiled itemtype.

Example Impex:

INSERT_UPDATE SolrSortField; sort(indexedType(identifier), code)[unique = true]; fieldName[unique = true]; ascending[unique = true]; sortPOS[default = 0]

Solution

  • Attributes ending 'POS' are usually a numeric ordering field associated with a relationship. The main relationship attribute typically has the same name but without 'POS'. These 'POS' fields only apply where that end of the relationship is flagged as 'ordered'

    In this case the relationship is SolrSort2SolrSortFieldRel with source configured as qualifier="sort" type="SolrSort" cardinality="one", and the target configured as qualifier="fields" type="SolrSortField" cardinality="many" collectiontype="list" ordered="true". In this one-to-many configuration, the relationship is modelled as an attribute on the many side 'sort' + the ordering field 'sortPOS'

    From an impex point-of-view: you just need to specify integer values in increasing order that correlate to the order in which you want the fields to appear for that SolrSort