Sorting

A search result is always sorted! If no explicit sorting is specified, the hits are "sorted" by their hit score, i.e. "best hits first". Scoring is performed by the search engine and score can also be adjusted ("boosted") via ExtendedDismaxParser params when using Searcher.

Only single-valued fields can be sorted!

Note that not all fields can be sorted! Only single-valued fields can be sorted.

  • Multivalued fields contains multiple values (hence, can not be sorted)
  • Analyzed fields are implicitly multi-valued (hence, should not be sorted)
  • String fields (solr.StrField) are case-sensitive (hence, casing can typically cause somewhat unexpected sort order. E.g: A, E, b, c)

Some indexes contains fields explicitly for sorting. These fields are CollationField's and their names are typically suffixed with ".sortable".