Archive

Archive for October, 2010

Add an item count to the SharePoint 2010 refinement panel

October 25, 2010 Leave a comment

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:

image

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.

image

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”.

image

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.

image

Since the Refinement Panel webpart is rendered using XSL you have many opportunities for design and customization to meet your branding needs.

Advertisements