This is a blog post in the series “How to set up a product-centric website in SharePoint Server 2013.” In this series, I'll use data from a fictitious company called "Contoso" to show you how to use search features to set up a website based on product catalog data.
Note: Most of the features described in this series are not available in SharePoint 2013 Online.
For an overview of the blog posts in this series, go to How to set up a product-centric website in SharePoint Server 2013.
In the previous blog post, I showed you how to add refiners for faceted navigation to a publishing site. By using category-specific refiners, visitors can easily find the product they are looking for. However, visitors can't easily see the different subcategories within a particular category.
In this blog post we'll learn:
- How to add a Taxonomy Refinement Panel Web Part to a page
- About the Taxonomy Refinement Panel Web Part
Start stage 16
Throughout this series, whenever I have introduced a new feature, I have started by explaining the feature, and then showed you how to configure it. In this post I will flip the sequence, as it will be easier to explain what’s going on by using screenshots of the Web Part.
Browse to the page where you want to add the Web Part. In our scenario, let's browse to "Cameras".
- Click the Settings menu, and then click Edit Page.
- In the Web Part Zone where you want to add the Web Part, click Add a Web Part.
- In the Categories list, click Search.
- In the Parts list, click Taxonomy Refinement Panel, and then click Add.
- Save the page.
That’s all there is to it! Without having to do any configuration, the sub-categories under "Cameras" are displayed. Also notice that refiner counts are automatically displayed.
If we browse to "Audio", the Audio subcategories are displayed with counts.
Let's start with a definition of this Web Part: The Taxonomy Refinement Panel Web Part filters search results from an associated Search Web Part, which show refiners based on the current navigation term.
For example, in our case the Web Part showed the sub-categories of “Audio” and sub-categories of “Computer”.
For the Taxonomy Refinement Web Part to work correctly, there are two conditions that have to be taken into account:
- The Taxonomy Refinement Web Part must be associated with another Search Web Part on the page that it is added to.
- The Taxonomy Refinement Web Part must be associated with the managed property that represents the managed navigation of the site.
At this point in the series, you probably understood this, but just in case you didn’t, let me explain it in the context of our Contoso scenario.
Let's start with the first condition.
Unlike the Content Search Web Part, the Taxonomy Refinement Web Part doesn’t contain a query. Because it doesn't query for content, it needs to receive search results from elsewhere to display content.
In the screenshot below, the Taxonomy Refinement Panel Web Part is shown in the default edit mode. In the Web Part Tool Pane, in the Query section, Refinement Target is set to Content Search - Default.
This configuration means that search results returned by the Content Search Web Part will be used as input by the Taxonomy Refinement Panel Web Part.
Check it out: first condition accomplished!
Now for the second condition: The Taxonomy Refinement Web Part must be associated with the managed property that represents the managed navigation of the site.
- Managed navigation is site navigation as defined by a term set.
- The term set is mapped to a site column.
- During crawl, the site column is represented as a managed property.
In the Taxonomy Refinement Panel Web Part tool pane, in the Query section, Refiner is set to owstaxIdProductCatalogItemCategory.
Explaining owstaxIdProductCatalogItemCategory requires a bit of back-tracking, but try to bear with me on this. Here we go:
- owstaxIdProductCatalogItemCategory is the managed property name of the Item Category site column.
- The Item Category site column is associated with the Product Hierarchy term set.
- The Product Hierarchy term is integrated into the Site Navigation term set.
- The Site Navigation term set is set to drive managed navigation on our Contoso site.
Check it out, second condition accomplished!
So, let's summarize:
- A visitor browses to "Cameras".
- The CSWP on the category page automatically issues a query for catalog items that are tagged with "Cameras" or any children of "Cameras", and displays this in the Web Part.
- The Taxonomy Refinement Panel Web Part uses the search result from the CSWP. Instead of displaying individual catalog items, it displays the categories to which the search results belong as refiner values, for example "Digital cameras" or "Camcorders."
So that’s pretty cool, but what makes the Taxonomy Refinement Panel Web Part even cooler, is that it accounts for previous queries or refinements that a visitor might have made when showing its refiners.
For example, on our Contoso site, if a visitor browses to "Cameras" and selects Fabrikam as the BRAND refiner, the Taxonomy Refinement Panel Web Part takes this refiner selection into account when displaying its refiner values.
To visitors, this makes browsing for products really convenient, because they can immediately see which sub-categories have Fabrikam camera products, without having to click back and forth.
So, that was all for this series.
If you are setting up your own site, I hope you will make good use of some of the features I have described.