Recently I was tasked with creating an application in SharePoint 2010, that should be used to manage important documents for a call center. For staff working at a call center, it is crucial to be able to retrieve information very quickly while on a call. To meet this requirement, I took this approach:
- Create an intuitive Document Library structure
- Use content types
- Create a local search center
- Define a custom search scope to limit search results
Usually, members of the call center are accessing the important documents by directly navigating to the Document Library where the documents are saved. Most of the staff worked for this call center for many months or years. The basic Document Library structure has been created based on their input, and that's the reason why they got familiar with the implemented library structure very quickly.
To access rarely requested information in an efficient manner, I created a local search center and configured it to use search refiners. Unfortunately, there is a problem with search refiners in SharePoint 2010 and with this blog post, I would like to explain how to overcome this problem.
To understand the problem, let's first have a look at a standard (out-of-the-box) search center in SharePoint 2010. To illustrate the problem, I created a basic SharePoint generic list and attached a basic content type to this list. The name of this list is 'Refiner Demo List' and the name of the content type that this list is using is 'Refiner Demo'.
The content type I'm using in this demo is a very basic content type with just one additional site column called Colour which is linked to a term set:
As a next step to prepare my demo environment, I created four different items and saved them to my 'Refiner Demo List':
The problem becomes visible when I search for an item of this list. Let's assume I'm searching for "Item 1". The following screenshot shows the result set and the refiners list:
Although "Item 1" has been found and the list of refiners also got updated, I was expecting to see 'Colour' as the headline above the refiners. Instead, SharePoint 2010 is showing 'Tags'. Why that?
To understand this, we need to take a look at the configuration of the refiners web part.
get access to the configuration data of
the refiners list, I need to open the “Filter Category Definition”.
SharePoint is opening a very basic text editor to display the refiners
configuration data. As you can see, search refiners are configured by using a
Each refiner configuration is encapsulated within a <Category> tag. If I look for 'Tags' (as this is the headline of the out-of-the-box refiner), I will find this:
<Category Title="Tags" Description="All managed metadata of the documents and social tags" Type="Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator" MetadataThreshold="3" NumberOfFiltersToDisplay="3" MaxNumberOfFilters="20" ShowMoreLink="True" MappedProperty="ows_MetadataFacetInfo,popularsocialtags" MoreLinkText="show more" LessLinkText="show fewer" />
This configuration is a kind of default configuration which is used to display all search refiners which are based on a term set. As long as there is at least one term set based site column in the list of search results, this default configuration ensures, that this site column is available as a search refiner. Usually this is helpful, because it creates valid search refiners almost automatically. In other words: You don't need to edit the refiner's configuration manually to display refiners based on taxonomy items.
In my case, the requirements have been different. I was using a local search center with a dedicated search scope, and the refiners list should be built of the site columns which have been defined for this application only. I don't want to have a list of tags – instead, the site columns names should be displayed as the headline for each group of refiners.
In this blog post, I would like to show how to do that. First, a new managed metadata needs to be created. In my demo I have created a site column named 'Colour' and that's why SharePoint 2010 has created a few crawled properties upon crawling the content automatically:
To be able to use this crawled property as a search refiner, I need to create a managed property based on this crawled property first:
After I have done that, a full crawl is required. As soon as the full crawl is finished, I can use this managed property to create a custom search refiner. To create a custom search refiner, the following configuration item needs to be added to the search refiners XML:
<Category Title="Colour" Description="All available colours" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="1" NumberOfFiltersToDisplay="4" MaxNumberOfFilters="20" SortBy="Frequency" SortByForMoreFilters="Name" SortDirection="Descending" SortDirectionForMoreFilters="Ascending" ShowMoreLink="True" MappedProperty="Colour" MoreLinkText="show more" LessLinkText="show fewer" />
Before I add this additional configuration to the search refiners web part, let's have a look at the category's properties first:
"Title" is the headline text that is displayed above the refiners.
"Description" is a textual explanation of this refiner.
"Type" describes the type of refiner. Because my additional search refiner is based on taxonomy, I need to use this predefined type (literally this type points to a SharePoint assembly which contains the code needed to handle the corresponding taxonomy items).
"MetadataThreshold" describes how many items using this refiner need to be part of the search result set before this refiner is displayed. As I want all custom refiners to be visible as soon as there is at least one item in the search results, I have set this to 1. Having too many refiners with this property set to 1 may cause performance issues.
"NumberOfFiltersToDisplay" and "MaxNumberOfFilters" are pretty self explanatory.
Same is true for "SortBy", "SortByForMoreFilters", "SortDirection", "SortDirectionForMoreFilters".
"MappedProperty" is the name of the managed property to be used.
"ShowMoreLink" defines if the "Show more" link should be visible and with "MoreLinkText" and "LessLinkText" you can change the text of that link.
Let's see if this additional configuration is working. To proof that it is working as expected, I have added the above XML to the web part's Filter Category Definition and I have unchecked "Use default configuration" (don't forget to uncheck this - otherwise your custom configuration will be overwritten by a default configuration built into the web part).
The refiners now look like this:
As you can see the out-of-the-box 'Tags' refiner is still shown and below our new 'Colour' refiner is displayed.
By simply adding an additional Category tag in the Filter Category Definition configuration, custom search refiners can be created and these custom refiners provide an improved usability and an enhanced user experience.