Plugin: Faceted navigation categories - custom sort date
Purpose
Use this plugin if you need to date sort facet categories that have a custom date format.
This plugin enables you to sort facets containing categories with labels that are dates, based on a custom date format. The facet label will be converted internally into ISO 8601 date and time with the offset format, yyyy-MM-dd’T’HH:mm:ss.SSSZ
(e.g. 2025-01-01T00:30:20.342+1100
) and then sorted alphabetically. Any facet label that cannot be converted into the date format will be sorted with the original label. The offset will be based on the server configuration.
This plugin is for sorting facet categories with text labels that are dates - facets that have categories based on metadata values. This should not be confused with facets that have category values based on date - which creates dynamic facet groupings (such as 'today', last month, Jun 2021) based on the date assigned to the document. See: Facet categories for additional information. |
Usage
Enable the plugin
-
Select Plugins from the side navigation pane and click on the Faceted navigation categories - custom sort date tile.
-
From the Location section, select the results page to which you would like to enable this plugin from the Select a results page select list.
The plugin will take effect as soon as you finish running through the plugin setup steps. |
Configuration settings
The configuration settings section is where you do most of the configuration for your plugin. The settings enable you to control how the plugin behaves.
The configuration key names below are only used if you are configuring this plugin manually. The configuration keys are set in the results page configuration to configure the plugin. When setting the keys manually you need to type in (or copy and paste) the key name and value. |
Facet category date format
Configuration key |
|
Data type |
string |
Required |
This setting is required |
Defines the facet category date format, specified as a Java SimpleDateFormat string. Parameter 1 should be set to the facet name. see: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html
Facet category locale
Configuration key |
|
Data type |
string |
Default value |
|
Required |
This setting is optional |
Defines the locale of the facet category to enable correct parsing of things like months specified in different languages. Parameter 1 should be set to the facet name. The value should be a valid Java Locale. see: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html
Facet category sort order
Configuration key |
|
Data type |
string |
Default value |
|
Allowed values |
ASC,DESC |
Required |
This setting is optional |
Defines the facet category sort order. Parameter 1 should be set to the facet name. 'DESC' - List the most recent dates first, 'ASC' - List earlier dates first (default).
Applying the custom sort to your facet
After you have configured this plugin you need to apply the custom sort to your facet. This is applied in the similar manner to other sort options. From your results page configuration screen:
-
Edit the faceted navigation configuration.
-
Select the facet to which you wish to apply this custom sorting.
When configuring this plugin ensure that the Parameter 1 values exactly matches the Name value of the facet that you are configuring (including case). If the parameter 1 value doesn’t exactly match the facet name then the sorting will not be applied to that facet, even if you have selected custom sorting for the facet. You can have keys with different Parameter 1 values so long as they match up with facets that have custom sorting configured. -
In the category sort options for the facet select 'custom' as the sort type.
-
Publish your changes. The sorting should take effect as soon as the changes are published.
Examples
Assume the server setting is UTC time for the examples below. |
Example 1
Consider a facet called Polish with the following categories: Cze 2025
,Gru 2021
,Kwi 2022
and Lut 2023
.
You wish to order these by date, with the most recent dates listed first.
This can be achieved with the following configuration:
Configuration key name | Parameter 1 | Value |
---|---|---|
Facet category date format |
|
|
Facet category locale |
|
|
Facet category sort order |
|
|
The order will be
-
Cze 2025
(2025-06-01T00:00:00.000Z) -
Lut 2023
(2023-02-01T00:00:00.000Z) -
Kwi 2022
(2022-04-01T00:00:00.000Z) -
Gru 2021
(2021-12-01T00:00:00.000Z)
Example 2
Consider a facet called Topic with the following labels: 21st Century
, 19th Century
, 2020s
,Dec 2021
and May 2022
.
You wish to order these by date, with the earliest dates listed first.
This can be achieved with the following configuration:
Configuration key name | Parameter 1 | Value |
---|---|---|
Facet category date format |
|
|
Facet category sort order |
|
|
The order will be
-
19th Century
-
2020s
-
Dec 2021
(2021-12-01T00:00:00.000Z) -
May 2022
(2022-05-01T00:00:00.000Z) -
21st Century
21st Century
, 19th Century
, 2020s
are sorted with the original labels while Dec 2021
and May 2022
are converted to date format. All of these are sorted alphabetically, so Dec 2021
and May 2022
are in between 2020s
and 21st Century
.