Using results collapsing

Applying result collapsing when you run the query

Grouping of search results does not occur unless you turn on result collapsing and define the grouping to apply.

There are a set of options that can be applied when the query is submitted. These options can be set as defaults within the results page, or passed in as parameters that are applied per-query.

Result collapsing options

The following options control how the result collapsing is applied and can be set in the query_processor_options of your results page or search package configuration; or set as request parameters when a search is run.

-collapsing=<boolean> (default: false)

Enable or disable result collapsing. Note that use of this option will disable result set diversification.

-collapsing_SF=<string> (default: no fields returned)

Metadata fields to include in display for collapsed documents (assuming collapsing_num_ranks is non-zero). (dflt no fields). To view metadata fields 'id' and 'a' set this to '[id,a]'.

-collapsed_docs_sort=<string> (default: doesn’t get applied, -sort takes precedence)

Controls how the nested collapsed results are sorted within the initial search response. Possible values:

  • date: Date, newest first

  • adate: Date, oldest first

  • title: Title, A-Z

  • dtitle: Title, Z-A

  • size: File size (smallest first)

  • dsize: File size (largest first)

  • url: Document URL, A-Z

  • durl: Document URL, Z-A

  • coll: Parent data source, A-Z, then score

  • dcoll: Parent data source, Z-A, then score

  • meta<f>: By metadata field f value, A-Z, then score

  • dmeta<f>: By metadata field f value, Z-A, then score

  • shuffle: Random order

  • prox: (for geospatial search) Proximity to origin (closest first)

  • dprox (for geospatial search) Proximity to origin (furthest first)

  • score_ignoring_tiers: Descending score, ignoring any tiers. Only useful with -sortall.

This only sorts the nested set of collapsed results. If you issue a query to return the group of collapsed results (e.g. clicking on the show N similar results link you can use the standard sort option for that because it is just a set of normal search results.)
-collapsing_label=<string> (default: 'which are very similar')

Label to indicate why items have been collapsed. (dflt "which are very similar")

-collapsing_num_ranks=<integer> (default: 0, acceptable value range: 0-1000)

Specify how many collapsed results are to be shown under the uncollapsed ones. (dflt 0)

-collapsing_scoped=<boolean> (default: false)

Scope to only documents which have been collapsed on. Default is off.

-collapsing_sig=<string> (default: [$] - document content)

The collapsing_control segment to use when collapsing. E.g. "[a,p]", collapse on author+publisher. The value must correspond to one segment of the indexing.collapse_fields string. (A segment is a comma separated list of fields surrounded by square brackets) (dflt '[$]' (Collapsing on document content.))

Set how the search results should be grouped

When running a search you also need to tell Funnelback how the results should be grouped. (e.g. group results that have the same title, or group results that have the same author).

This is achieved by passing the collapsing_sig parameter, which is set to one of the collapsing signatures that are defined for your search. (see: Set up result collapsing groups).



Configure the results page

Browse to the manage results page screen and the edit the results page configuration, making the following changes:

  • Add -collapsing=on to the query_processor_options setting. This will enable result collapsing at query time.

  • Set the relevant display query_processor_options (e.g. -collapsing_sig, -collapsing_num_ranks and -collapsing_SF) on the results page.

The decision to set these parameters in your results page configuration (as query_processor_options or as request (URL) parameters) will depend on how you are using your result collapsing. If the search should be grouped by default in a particular way then set the parameters in the configuration. If you need to define your groupings dynamically then pass in the settings as request parameters. You can also set some options in configuration (e.g. -collapsing=on) and others dynamically (e.g.[author])