Forum Discussion
Container tree - PnP Modern Search
Hello everyone,
I am trying to create a page on one of my SP sites dedicated to search. Specifically, I want to use tags/labels as filters.
So far, I have managed to do this using the PnP Modern Search filter tool on one level (I create a column, map the crawled properties with a RefinableString, and configure the filter).
Now I would like to do the same thing, but this time on multiple levels with a tree structure. I've created a TermSet and in the filter configuration, I saw this “Container tree” option, but nothing works, and I can't find any help or documentation on the subject.
Does anyone have any information? Or a way to use this option and have tree view on the filter?
Thank you in advance, any help will be greatly appreciated.
Kind regards
5 Replies
- SMARTGAMER2026Brass Contributor
Hi FabienG, to be direct: the 'Container Tree' option you are seeing is a known limitation—it does not currently support true hierarchical rendering for standard SharePoint managed properties because, as Dave noted, those properties are stored as a flat list in the search index.
Since the community standard hasn't bridged this gap, here is the only reliable way to implement a tree-view filter:
Custom Refiner Template: You must move beyond the 'Standard' filter templates. You need to develop a custom Handlebars template for the PnP Modern Search filter web part.
Logic Injection: Your custom template needs to include JavaScript logic that takes the 'flat' response from the Search API and parses the taxonomy hierarchy (based on the term set path, e.g., L0|#ParentTerm|L1|#ChildTerm) into a nested HTML structure.
The Metadata Requirement: Ensure your Term Set is properly mapped to a RefinableString managed property that contains the full path (WSSId). Without the path data, the front-end code cannot reconstruct the parent-child relationship.
If you aren't a developer, the 'workaround' is to create separate search verticals for each primary category, rather than trying to force a tree structure into a single filter panel. Anything else will be a circular path of trial-and-error.
Why the previous replies in this thread are incorrect/insufficient:
KasperLarsen (Iron Contributor): Incorrect. They suggested that the feature is simply in 'basic' or 'upcoming' status. In reality, the technical bottleneck is not a 'version' issue—it is an architectural one. Even in newer versions, the Search API will return flattened results unless custom logic is applied. They are promising a feature that the underlying platform cannot natively support without an API extension.
Jennifer Burback (Copper Contributor): Partial. While their workaround (using sub-pages and selectable items) works for navigation, it is not a 'search' solution. It fundamentally changes the user experience and is not a valid answer for someone trying to implement a filterable search refiner.
DaveMate84R (MVP): Correct on the 'why' (flat properties), but insufficient. They correctly identified that the hierarchy is lost, but they stopped at the problem without offering a technical path forward.
- KasperLarsenIron Contributor
The hierarchical refiner has been a feature request for years, and I am happy to announce that a basic version is available in the 4.21 version, and further options are available in the 4.22 version. Multiselect is on my todo list but there is no ETA
- Jennifer BurbackCopper Contributor
I've looked into this without success as well. I use pages, with metadata, and subpages, then on those pages I use selectable items, that display sub items in other web parts, but that's no hierarchy. You can use search verticals with your filters, but that's not the fix either, just a work around.
As mentioned, it's been on the wish list for years.
- KasperLarsenIron Contributor
The hierarchical refiner has been a feature request for years, and we would love if someone would implement it. We know that it can be done as it is a feature in the commercial offering by Sword Group
Hi FabienGi
there is no option to do that in the standard solutions. The value in the property are flat, the values in the search properties have no hierarchies.
I think a possible solution is to develop a tree view like a term store hierarchy.
When you find another solution, im also interested 😉
Best, Dave