Home > SharePoint 2010, SharePoint Designer 2010, Visual Studio 2010 > Add an item count to the SharePoint 2010 refinement panel

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:

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
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: