Sorting and renaming faceted navigation categories

this article applies to Funnelback 15.10 and earlier. In Funnelback 15.12 sorting is natively supported and discussed in the faceted navigation documentation.

Background

Sometimes there is a need to present a different category name to the user that what was generated from the source data or to sort the categories in a different order.

There are a few techniques that can be used to achieve this.

Renaming categories

Change the names at the source

Arguably the best approach - this involves updating the source content to have the correct labels. This isn’t always possible though as you often have no control over the source content.

Alter the category names prior to indexing

The technique involves modifying the data that has been gathered so that the indexer stores the correct labels within the index.

This can be achieved by writing a crawl (groovy) filter that corrects the labels as the files are gathered.

Alter the category names at presentation time

Another technique is to alter the category names as they are being presented. The method of implementing this depends on the UI that is being used.

Modern UI

A user interface hook script can be used to update the category labels that are stored in the Modern UI data model.

Use the post_process_hook.groovy script included with the replacement faceted navigation GitHub project to rename categories.

Classic UI

Use the <s:CategoryRename> form tag to rename categories.

Sorting categories

Modern UI

In Funnelback 15.12 and newer sorting is natively supported and discussed in the faceted navigation documentation.

Sorting date range facet categories

For sorting of date facets (v13+) use the faceted_navigation.date.sort_mode collection.cfg option.

Sorting non-date range facet categories

For other facets or arbitrary sorting on a date facet, a hook scricpt can be used to alter the sort order in the Modern UI.

Use the post_process_hook.groovy script included with the replacement faceted navigation macros.

Once installed sorting is configured, per facet, using collection.cfg options.

Classic UI

This applies to v14.2 and earlier when using the Classic UI.

Use the sortBy attribute of the <s:Category> tag to sort by count, alphabetical or combo sorting.

Use the <s:categorySortOrder> tag to define an arbitrary sort order.