Skip to content

Sort options


Funnelback offers a variety of different sorting options for ordering results. This can be done by setting a query processor option or CGI parameter.

The query processor option is:


while the equivalent CGI parameter is sort e.g. sort=date.

Sort typeSort results by
dateDocument dates (newest first)
adateDocument dates (oldest first)
titleDocument title (0,9 - A-Z)
dtitleDescending document title (Z-A, 9-0)
metaXMetadata class X (0..9, A-Z), then score
dmetaXDescending metadata class X (Z-A, 9-0), then score
proxGeospatial proximity (nearest first)
dproxDescending geospatial proximity (furthest first)
sizeFile size (largest first)
dsizeDescending file size (smallest first)
urlURL (0-9, A-Z)
durlDescending URL (Z-A, 9-0)
collCollection name (0-9, A-Z), then score
dcollDescending collection name (Z-A, 9-0), then score
shuffleRandom (see note below)

Date sort (date, adate)

By default, future dates are ignored during sorting. Allowing future dates will require a modification to the collection's indexer options.

Geospatial proximity sort (prox, dprox)

A user's location will be inferred from their IP address unless overridden with an explicit origin=lat,long CGI value. Results that do not have a geospatial component will be regarded as being an 'unknown' distance away, and will always appear after the results that do have a geospatial component.

Random sort (shuffle)

When -sort=shuffle is set, an additional parameter also needs to be set to ensure that the random sort that is chosen is maintained across search result pages.

This is done by setting the -rseed query processor option, which sets a random seed to use for the search. This parameter must be passed between search pages.

For truly randomised search, the rseed value should be set dynamically for each search (so not as a query processor option) otherwise you'll always get the same random sort for all queries.

The rseed value isn't set automatically - if you set sort=shuffle you'll need a hook script to set this value, and you'll need to ensure your forms and all search UI links pass through the rseed value.

Modern UI - pre process hook script

The following code can be set up as a hook_pre_process.groovy script and sets a random seed for a search if an rseed value is not set.

def q = transaction.question

// Set random seed (only if in shuffle mode, and if not already set)
if (q.inputParameterMap["sort"] != null) {
  if (q.inputParameterMap["sort"] == "shuffle") {
    if (q.inputParameterMap["rseed"] == null || q.inputParameterMap["rseed"] == "") {
      q.inputParameterMap["rseed"] = Math.abs(new Random().nextInt() % 9999 + 1).toString();

Sorting partial matches

The sort modes, by default will sort results within result tiers - so all fully matching results will be sorted, then all results matching 1 out of 2 words.

The result tiers can be ignored by setting two additional options:

-tierbars=false - turn off result tierbars.

-sortall=true - include partial matches when resorting results.

Case-sensitive sort

Sorting is normally case-insensitive.

This behaviour can be altered to perform case-sensitive sorting by setting the following option:

-sort_sensitive=true - Use case-sensitive sorting when sorting results by title or metadata strings.


Funnelback logo