Configure Sorting and Limiting of Result Sets
Overview
This page explains how to configure sorting and limiting of result sets in a faceted navigation tree in Bloomreach Content.
Note: This topic covers sorting and limiting result sets (the documents returned by a faceted navigation node). To configure sorting and limiting of facet values (the values shown for each facet), see Configure Sorting and Limiting of Facet Values.
Sorting Result Sets
By default, documents in a faceted navigation result set are sorted by their score, with the highest score first.
To sort results by one or more document properties, set the multi-valued string property hippofacnav:sortby on the faceted navigation node:
/content/documents/myproject: /faceted-news: jcr:primaryType: hippofacnav:facetnavigation hippo:docbase: d2b1775c-fb97-4080-bd66-ede4ac874b5a hippofacnav:facets: [ myproject:author, myproject:source ] hippofacnav:facetnodenames: [ Author, Source ] hippofacnav:sortby: [ myproject:date, myproject:title ]
By default, sorting is ascending. To specify the sort order for each property, set the multi-valued string property hippofacnav:sortorder. The order and number of values in hippofacnav:sortorder must match those in hippofacnav:sortby.
hippofacnav:sortorder: [ descending, ascending ]
Optionally, you can define a sort function for each property using the multi-valued string property hippofacnav:sortfunction. Supported values are lower-case (for case-insensitive sorting) and normalize (to ignore diacritics). The order and number of values in hippofacnav:sortfunction must match those in hippofacnav:sortby.
hippofacnav:sortfunction: [ lower-case, normalize ]
If you use hippofacnav:sortfunction, you must specify a function for each property in sortby. You cannot use an empty string to indicate default (case-sensitive) sorting. For more information, see HSTTWO-3967.
Limiting Result Sets
To limit the number of documents returned in a result set, set the optional long property hippofacnav:limit on the faceted navigation node. Limiting result sets is recommended for performance and memory efficiency, especially when result sets can contain thousands of documents. Setting a limit prevents excessive memory and CPU usage.
/content/documents/myproject: /faceted-news: jcr:primaryType: hippofacnav:facetnavigation hippo:docbase: d2b1775c-fb97-4080-bd66-ede4ac874b5a hippofacnav:facets: [ myproject:author, myproject:source ] hippofacnav:facetnodenames: [ Author, Source ] hippofacnav:limit = 100
Note: For more information about performance considerations, see Faceted Navigation Performance & Troubleshooting.