The new search refinement panel in SharePoint 2010 search is pretty cool! When you fire up a search you can see the various pieces of metadata that match the search results and then drill down from there.
But what if you want to add your own? Well its actually very easy if the column type that you want to add is Managed Metadata. If you are adding other columns types you have to do it the old SharePoint 2007 way where you have to crawl the property, create a managed property, do the mapping and then add the XML into the Refinement Panel.
But if the column is a Managed Metadata column then the SharePoint search engine will actually create managed properties out of the crawled properties for you so you don’t even have to do that! So all you need to do is add the following xml to Refinement Panel Filter Category Definition XML file:
So the XML is below:
<Category Title="Field Name" Type="Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator" MappedProperty="ows_MetadataFacetInfo" MoreLinkText="Show More" MetadataThreshold="1" NumberOfFiltersToDisplay="5"/>
Ok there are a bunch more options that you can add but put simply you need the following:
- Title: This is the name of the Column or Field that the Managed Metadata is mapped to. If the field has a space that’s ok but remember its the column name
- Type: This has to be the TaxonomyFilterGenerator for Managed Metadata fields (for other fields you use the ManagedPropertyFilterGenerator class)
- Mapped Property: For Managed Metadata fields this is ALWAYS ows_MetadataFacetInfo, SharePoint will do the rest!
You can actually have a look at the default Filter Definition Configuration file and see that there it two Categories defined in this exact fashion: Managed Metadata Columns and Tags. The difference between the two is that Tags is the Enterprise Keywords while Managed Metadata Columns are used for well Managed Metadata Columns! So if you want to force or create your own refiners follow the steps above and you should be all good!
Need more information about the refinement panel, try these links:
- Refining on Content Type in SharePoint 2010
- Custom Refinement Filters in SharePoint 2010 Overview
- Show Percentages in SharePoint 2010 Search Refiner Counts
- Adding Search Refiners in SharePoint 2010
- Refinement Panel MetadataThreshold Configuration
- SharePoint 2010 Search Refinement Panel Options