Configure Human-Readable Date Facets
Overview
This page explains how to configure human-readable date facets in a faceted navigation tree.
When to Use
By default, when you use a date property as a facet in faceted navigation, the facet values display as milliseconds since the Unix epoch. To present dates in a readable format, you can configure the facet to use specific date resolutions such as year, month, or day.
Date Resolutions
To set a resolution for a date facet, append a dollar sign ($) and the resolution name to the property in the hippofacnav:facets property. For example:
myproject:date$year
Supported date resolutions:
yearmonthweekdayofyeardayofweekday(day of month)hourminutesecond
Note: The
monthresolution is zero-based: January is 0, December is 11. This matches the behavior ofjava.util.Calendar.
Example Configuration
To allow users to navigate news documents by publication date, configure the faceted tree as shown below:
/content/documents/myproject: /faceted-news: jcr:primaryType: hippofacnav:facetnavigation hippo:docbase: d2b1775c-fb97-4080-bd66-ede4ac874b5a hippofacnav:facets: [ myproject:date$year, myproject:date$month, myproject:date$day ] hippofacnav:facetnodenames: [ Year, Month, Day ]
This configuration produces a faceted tree structure similar to the following:
/content/documents/myproject: /faceted-news [30]: /Year [27]: /2015 [1]: /2016 [18]: /Year [18]: /Month [18]: /6 [3]: /8 [9]: /Year [9]: /Month [9]: /Day [9]: /12 [3]: /17 [3]: /23 [3]: /hippo:resultset [9]: /hippo:resultset [9]: /9 [6]: /hippo:resultset [18]: /Day [18]: /hippo:resultset [18]: /2017 [6]: /hippo:resultset [27]: /Month [27]: /Day [27]: /hippo:resultset [30]:
With this faceted tree, you can implement a delivery tier that renders navigation options for users to filter results by year, month, and day. You can also use this structure to build calendar-based navigation, as demonstrated in the Events section of the GoGreen demo.
Note: To control the order in which facets become available (for example, only display months after a year is selected), see Configure a Guided Drill Path in a Faceted Tree.