1.18.2 Sorting of records

If a collection has been opened, the records contained in it are listed in the standard sort (by relevance) for search hits. This sorting can be overridden individually for each collection, if required, by specifying a Solr sort field:

<collections>
    <collection field=”DC”>
        <defaultSortFields>
            <field collection="collection1">SORT_TITLE</field>
        </defaultSortFields>
    </collection>
</collections>

In the above example, the collection collection1 is sorted by record title by default. The initial sorting after opening can again be changed by manually selecting the sorting in the sort menu.

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 attribute multiValued must not have the value true).

You can also define rules for subcollections of a collection. In the example below, the sort field SORT_TITLE for "collection1" is defined in the first <field> element. The second <field> element assigns the same sort field to all subcollections of "collection1" (recognizable by the hierarchy separator "." and the truncation "*" after the collection name). This rule can, however, be overwritten for individual subcollections (independent of the hierarchy level). The third <field> element defines the sort field SORT_AUTHOR for the subcollection "collection1.subcollection2.subcolletion99" (and only these), while all other subcollections are still sorted according to SORT_TITLE.

<collections>
    <collection field=”DC”>
        <defaultSortFields>
            <field collection="collection1">SORT_TITLE</field>
            <field collection="collection1.*">SORT_TITLE</field>
            <field collection="collection1.subcollection2.subcolletion99">SORT_AUTHOR</field>   
        </defaultSortFields>
    </collection>
</collections>

Last updated