Configure Sorting and Limiting of Result Sets
Introduction
Goal
Configure sorting and limiting of result sets in a faceted tree.
Background
In a faceted tree, documents in a result set are by default sorted by their score. It is possible to configure a different sorting and sorting order, as well limit the number results.
Example
Sort the Documents in the Result Set
By default, results are ordered by score, with the best score first.
To sort by one or more document properties, use the multi-valued String property hippofacnav:sortby:
/content/documents/myhippoproject + faceted-news [hippofacnav:facetnavigation] - hippo:docbase = d2b1775c-fb97-4080-bd66-ede4ac874b5a - hippofacnav:facets = - myhippoproject:author - myhippoproject:source - hippofacnav:facetnodenames = - Author - Source - hippofacnav:sortby = - myhippoproject:date - myhippoproject:title
The default sort order is ascending. To specify the sort order for each sortby property, use the multi-valued String property hippofacnav:sortorder:
- hippofacnav:sortorder = - descending - ascending
The number of values and the order of the values of hippofacnav:sortorder must match those of hippofacnav:sortby.
Optionally, specify a sort function for each sortby property to sort either case-insensitive (sort function lower-case) or ignoring diacritics (sort function normalize) using the multi-valued String property hippofacnav:sortfunction:
- hippofacnav:sortfunction = - lower-case, - normalize
The number of values and the order of the values of hippofacnav:sortfunction must match those of hippofacnav:sortby.
Limit the Number of Documents in the Result Set
To limit the number of results in any result set in the faceted tree, add the optional Long property hippofacnav:limit. This is recommended for performance and memory reasons, as the result set can easily contain tens/hundreds of thousands of results. You most likely will only need no more then X of them. Set this as limit. Not doing so can lead to unnecessary high memory and CPU loads.
/content/documents/myhippoproject + faceted-news [hippofacnav:facetnavigation] - hippo:docbase = d2b1775c-fb97-4080-bd66-ede4ac874b5a - hippofacnav:facets = - myhippoproject:author - myhippoproject:source - hippofacnav:facetnodenames = - Author - Source - hippofacnav:limit = 100