1.17.1 Sorting

The sorting of the search hit list can be configured as follows:

<search>
     <sorting enabled="true">
           <field>RANDOM</field>
           <field default="true">RELEVANCE</field>
           <field>SORT_CREATOR</field>
           <field dropDownAscMessageKey="searchSortingDropdown_az" dropDownDescMessageKey="searchSortingDropdown_za">SORT_TITLE</field>
           <field>SORT_YEARPUBLISH\;SORT_TITLE</field>
            <static>
                 <field>!BOOL_PRIORITIZE</field>
           </static>
     </sorting>
</search>

With the Attribute enabled the sorting can be switched off completely (default value is true). The elements <field> define the Solr fields, according to which the sorting can be done. The order of the listing corresponds to the displayed order. For each configured field, an ascending and descending option is automatically displayed.

If a sort field is to be used immediately on the first search, before the user has selected an explicit sort, this can be displayed with the default="true" attribute.

The terms RELEVANCE and RANDOM are static terms for which no ascending and descending option is provided.

For the ascending and descending options, the words ascending and descending are used by default. However, the attributes dropDownAscMessageKey and dropDownDescMessageKey can be used to define a custom value. In the example above, this has been done for the title, where alternatively "A-Z" and "Z-A" are displayed.

Several sort fields can be specified one after the other, separated by semicolons. An example is shown in the above code block with SORT_YEARPULISH;SORT_TITLE. This means that the hits are first sorted by SORT_YEARPUBLISH. The records that do not contain the metadata are listed below according to SORT_TITLE.

An additional static list of sort fields <static> can be used to always place certain works on top based on the presence of a certain index field. The fields configured here are applied in the sort order before the normal sort fields and are not visible to the user. With a preceding exclamation mark the order can be adjusted from ascending to descending.

The fields used for sorting must not be fields with multiple values (that is, in their declaration in /opt/digiverso/solr/solr/server/solr/configsets/goobiviewer/conf/schema.xml, the multiValued attribute must not have the value true).

Last updated