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.

To sort by relevance either remove the sort parameter or set the value of sort to an empty value.

Sort type Sort results by
Relevance / score
date Document dates (newest first)
adate Document dates (oldest first)
title Document title (0,9 - A-Z)
dtitle Descending document title (Z-A, 9-0)
metaX Metadata class X (0..9, A-Z), then score
dmetaX Descending metadata class X (Z-A, 9-0), then score
prox Geospatial proximity (nearest first)
dprox Descending geospatial proximity (furthest first)
size File size (largest first)
dsize Descending file size (smallest first)
url URL (0-9, A-Z)
durl Descending URL (Z-A, 9-0)
coll Collection name (0-9, A-Z), then score
dcoll Descending collection name (Z-A, 9-0), then score
shuffle Random (see note below)
collapse_count Number of collapsed documents, largest collapsed set first
acollapse_count Number of collapsed documents, smallest collapsed set first
score_ignoring_tiers Descending score value, ignoring any tiers. Only useful with sortall.

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();

Score ignoring tiers (score_ignoring_tiers)

Normal score sorting ensures that results that match the most query constraints are displayed above those that match fewer constraints. This applies even if the lower result might have a higher score because, for example, it has a very large number of matches for the terms it does match, and because those matches are in a field with a high weighting.

-sort=score_ignoring_tiers overrides this behavior to cause all results regardless of their tier (how many constraints they match) to be sorted by score.

Please note that

  1. -sortall=true is required for results in tiers below the first to be sorted, hence is required for -sort=score_ignoring_tiers to have any impact.

  2. Result set diversification is no longer applied when -sort=score_ignoring_tiers is used.

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