Plugin: Group search results

Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin.

Purpose

This plugin enables the grouping of search results by data source or metadata.

There is a related feature, result collapsing, which provides some different options for grouping search results.

Usage

Enable the plugin

Enable the grouping-results-by-criteria plugin on your results page from the Extensions screen in the administration dashboard or add the following results page configuration to enable the plugin.

plugin.grouping-results-by-criteria.enabled=true
plugin.grouping-results-by-criteria.version=1.0.0
The plugin will take effect as soon as it is enabled.

Plugin configuration settings

The following options must be set in the results page configuration to configure the plugin:

  • plugin.grouping-results-by-criteria.config.mode: (Required) Defines what will be used to group the search results. Acceptable values are SOURCE - group by the data source to which the result belongs; or METADATA: group the results on a metadata value.

  • plugin.grouping-results-by-criteria.config.metadata_class: Defines the metadata class that will be used to group the search results. Required, when using the METADATA mode. Set this to the metadata class ID that you wish to group.

The following options enable the plugin to be used in conjunction with a tab facet (as defined in the faceted navigation configuration of the results page).

  • plugin.grouping-results-by-criteria.config.tabs_facet_name: (Optional) If being used with a search that has a tab facet, defines the name of tab facet to which grouping will be applied. Default: Tabs.

  • plugin.grouping-results-by-criteria.config.tabs: (Optional) Indicates which tabs of the tab facet the grouping will be applied to. Set this to a comma separated list of tab category names. Default - apply grouping to all tabs.

  • plugin.grouping-results-by-criteria.config.target_facet : (Optional) If being used with a search that has a tab facet, defines the name of target tab facet for see more links. Default:

    • If using SOURCE mode, the data source name.

    • If using METADATA mode, the metadata class name.

  • plugin.grouping-results-by-criteria.config.link_label.SOURCE-OR-METADATA-VALUE: (Optional) Defines the see more label to display for the group of results. SOURCE-OR-METADATA-VALUE corresponds to the value of the data source or metadata that is being used to group the results. Clicking the see more link will take you to a more results listing on the corresponding tab in the target facet (indicated by plugin.grouping-results-by-criteria.config.target_facet). When facet tabs are not available, then see more link will re-run the current search and restrict the results to items from the same data source (if in SOURCE mode), or items with the same metadata field value set (if in METADATA mode).

Examples

Group search results by data source

Consider a university search where you have course, people, event and web results each indexed in separate data sources.

The following configuration can be used to group the search results by the data source.

plugin.grouping-results-by-criteria.config.mode=SOURCE

Group search results by metadata value

Consider an ecommerce search where you have type metadata, mapped to the productType metadata class.

The following configuration can be used to group the search results by type.

plugin.grouping-results-by-criteria.config.mode=METADATA
plugin.grouping-results-by-criteria.config.metadata_class=productType

Use search results grouping with tabs

Consider a membership association search that includes event and journal data sources.

The search includes a tab facet named Tabs which is configured with three tabs:

  • All results, containing all search results

  • Events, containing results from the ds-membership-association-events data source

  • Journals, containing results from the ds-membership-association-journals data source

The following configuration can be used to group the search results when viewing the all results tab, and produce see more links to the corresponding tabs.

plugin.grouping-results-by-criteria.config.mode=SOURCE
plugin.grouping-results-by-criteria.config.tabs=All Results
plugin.grouping-results-by-criteria.config.target_facet=Tabs
plugin.grouping-results-by-criteria.config.target_facet_label.membership-association-events=Events
plugin.grouping-results-by-criteria.config.target_facet_label.membership-association-journals=Journals

All versions of grouping-results-by-criteria