Configure a Guided Drill Path
Overview
This page explains how to configure a guided drill path in a faceted navigation tree.
When to Use
By default, users can select facets in any order within a faceted tree. They can also select the same facet multiple times to combine different values. If your use case requires users to follow a specific order when selecting facets, or if you want to hide certain facets based on previous selections, configure a guided drill path.
Prerequisites
- A faceted navigation tree is already configured.
- You have access to modify the
hippofacnav:facetnodenamesproperty in your content repository.
Implementation
To control the order in which facets become available or to hide facets based on selections, use the after and hide parameters in the hippofacnav:facetnodenames configuration.
Make a Facet Available After Another
To display a facet only after another facet is selected, use the after parameter. For example, to show the "Month" facet only after "Year" is selected:
Month${after:'Year'}
Hide a Facet When Another Is Selected
To hide a facet when another facet is selected, use the hide parameter. For example, to hide "Month" when "Year" is selected:
Month${hide:'Year'}
You can hide a facet for multiple selections by providing an array:
Month${hide:['Month', 'Year']}
Example
Assume you have a project created from the Maven archetype with the News feature added. You have set up a faceted tree with three date facets: Year, Month, and Day.
You want the following behavior:
- "Month" becomes available only after "Year" is selected.
- "Day" becomes available only after "Month" is selected.
- Redundant facets are hidden based on the current selection.
Configure the hippofacnav:facetnodenames property 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${hide:'Year'}",\ \ "Month${after:'Year', hide:['Month','Year']}",\ \ "Day${after:'Month', hide:['Day','Month','Year']}" ]
This configuration produces a faceted tree with the following structure:
/content/documents/myproject:
/faceted-news [30]:
/Year [27]:
/2016 [18]:
/Month [18]:
/8 [9]:
/Day [9]:
/12 [3]:
/17 [3]:
/23 [3]:
/hippo:resultset [9]:
/hippo:resultset [9]:
/9 [6]:
/6 [3]:
/hippo:resultset [18]:
/hippo:resultset [18]:
/2017 [6]:
/hippo:resultset [27]:
/hippo:resultset [30]:
Hint:
To improve usability, you can also sort facet values. For example:hippofacnav:facetnodenames: [ "Year${hide:'Year', sortby:'facetvalue', sortorder:'descending'}",\ \ "Month${after:'Year', hide:['Month','Year'], sortby:'facetvalue', sortorder:'descending'}",\ \ "Day${after:'Month', hide:['Day','Month','Year'], sortby:'facetvalue', sortorder:'descending'}" ]