I wanted to document this here just because it took me a little while to get all the bits working just right so I could have a hierarchical taxonomy display inside a Facet API search facet, rather than a flat display of only the taxonomy terms directly related to the nodes in the current search.
Basically, I had a search facet on a search page that allowed users to filter search results by a taxonomy term, and I wanted it to show the taxonomy's hierarchy:
To do this, you need to do two main things:
- Make sure your taxonomy field is being indexed with taxonomy hierarchy data intact.
- Set up the Facet API facet for this taxonomy term so it will display the full hierarchy.
Let's first start by making sure the taxonomy information is being indexed (refer to the image below):