Add an item count to the SharePoint 2010 refinement panel
In the SharePoint 2010 search results page there is a new webpart called the refinement panel.
This webpart displays facets, or refinements to the SharePoint 2010 search results based on categories that you can configure.
One common request in SharePoint 2007 was to add faceted search results with a count of items that belong to each facet.
Since faceted search results were not included in MOSS 2007 a common solution was to use a set of webparts available from CodePlex. http://facetedsearch.codeplex.com/
In SharePoint 2010 the faceted search is available right on the search results page.
However, one thing that is not visible, without some additional steps, is the count of items in each facet.
The goal:
![]()
The first step is to edit the Faceted Search webpart, then add a line to the Filter Category Definition XML in the Refinement Panel webpart.
A tutorial of what the Filter Category Definition XML can do and how to extend the categories.
Add ShowCounts="Count" to each category you wish to include the count of results for.
In this example I added the ShowCounts=”Count” to the Category where the Title=”Site”.
The inclusion of counts is determined by the XSL of the Refinement Panel webpart.
The XSL parameter $ShowCounts looks for the value of ShowCounts=”Count” in the category XML.
Since the Refinement Panel webpart is rendered using XSL you have many opportunities for design and customization to meet your branding needs.
Thanks for the post about the refinement panel. I am just getting into customizing the panel. I tried the steps you listed and when applying changes I receive the error: Validating filter config XML: The ‘FilterCategories’ start tag on line 1 does not match the end tag of ‘Category’. Line 1, position 3113.
I only added ShowCounts=”Count” and didn’t edit anything else. Am I missing something?
Thanks for the help.
@Ga-Hsin
Hello, it seems that the xml in the Filter Category Definition is no longer well formed.
Perhaps double-check that you added the ShowCounts=”Count” within a Category tag and that the closing bracket is still there.
@Neal McFee
thank you! I believe there was something else wrong with my refinement panel before. I started over and the counts are now working. Thanks for your help.