DDR-Public Results Sorting and Relevance Ranking
Sort Options
By default all browse and search results are sorted by relevance.
User selectable search options in DDR-Public include:
- relevance
- title
- date (old to new)
- date (new to old)
We can add other sort options to this list so long as the field is indexed for sorting in Solr (see Field Settings for Display, Search, Sort, and Facets for more detail).
Relevance Scoring
Solr/Lucene assigns a relevance score to each document in a result set by comparing the user's query and the indexed documents. This relevance score is used to sort the results. The exact process by which Solr assigns a relevance score is beyond the scope of this document (more information here: Lucene and Solr documentation).
It's important to note that relevance is only meaningful when searching for text in the index. When a user searches a result set and then narrows the set using a facet – the facet selection only narrows the set of matching documents. Facets do not affect the relevance score of matching the documents. When browsing the index using only facets, such as when clicking a link in the interface to browse all items or collections, there is no text query that Solr can use to assign a score. In these cases, every matching document has the same score.
Relevance Tiebreakers
Tiebreaker fields are used to further sort any documents that have a matching relevance score.
In DDR-Public the relevance tiebreaker fields are: date ascending and then title ascending.
This means, in effect, that when browsing the repository without a text search the sort order of results is first date ascending and any date ties are further sorted by title ascending.
A Note on Title Sorting
Title is a string and sorted lexically, meaning that titles sort in character order. When titles contain numerals that supply a numeric order to a title they will not sort numerically.
For example the following Duke construction titles will sort like this:
- East Campus Progress Picture #118
- East Campus Progress Picture #119
- East Campus Progress Picture #12
- East Campus Progress Picture #120
To produce the desired sort order, we need to pad out the numerals so their lexical sort matches their numeric sort:
- East Campus Progress Picture #012
- East Campus Progress Picture #118
- East Campus Progress Picture #119
- East Campus Progress Picture #120