In this series:
- Search Refiners part 1 – Expanding the OOTB search Refinement Panel (this post)
- Search Refiners part 2 – Use of CustomFilters
- Search Refiners part 3 – Chart based
- Search Refiners part 4 – User selection based
A large multinational company has several contracts. These contract are stored in SharePoint. Based on the
multinational character of the company the contracts are stored in different languages.
Titles of the documents are all in English, so there is no way to determine from the title in what language the
document is written. Therefor a new column is introduced where the language can be stored.
This column in a lookup column to another list where all the languages are defined.
When people are searching for contracts there is no quick way to see in what language the document is written. To
prevent users to open multiple documents to see the language of the content a search refiner will help them out.
The existing OOTB refinement panel can be expanded just with XML.
Before doing so some preparations has to be done.
First a custom list has to be created which will store the possible language values.
A document library has to be added to a site which will contain the documents for the contracts. An additional column
has to be added to let the user choose the language in which the document is written. This will be a lookup column to
the previous created list of languages.
A set of documents are uploaded with their languages set.
Start Central Administration, select Application Management and Manage Service Applications. Select Search Service
Application to display the Search Administration page.
Select Content Sources and start an incremental crawl.
Create managed property
Check if any results are present in the crawled property.
Modify Filter Category Definition
Create an Enterprise Search Center and edit the Refinement Panel. In the webpart properties in the section Refinement
select the button next to the Filter Category Definition textbox to show all the text in it.
The XML is not difficult to read and understand when copying and pasting the XML into an XML file in Visual Studio..
Even without checking on the full Refinement Panel XML schema it’s pretty clear what to do by copying an existing
Category element and make some changes.
Full explanation of this schema can be found on MSDN here http://msdn.microsoft.com/en-us/library/ee819920.aspx �
Add to the filter category definition in the webpart properties:
<Category Title="Language" Description="Language of document" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="3" NumberOfFiltersToDisplay="3" MaxNumberOfFilters="20" ShowMoreLink="True" MappedProperty="Language" MoreLinkText="show more" LessLinkText="show fewer" />
Don’t forget to uncheck ‘Use default configuration’.
Unchecking this option is quite important. When this checkbox is selected any changes to the filter category definition
configuration are not persistent. A better experience would be disabling the Filter Category Definition when this
checkbox is selected…
Apply and save the changes.
Test the refiner
The values displayed of the Language refiner is default sorted by count. This means the value which is used most
appears on top.
Refiner is not showing
When the refiner is not showing in the Search Center there are a few things to check.
- Make sure to fully crawl the content after creating the managed property and confirm the crawled property contains
- Make sure there is enough data which uses in this case the language. In the above XML the value of the
MetadataThreshold attribute is set to 3. This means the number of results that must contain a value to display the
filter generator under the filter category is set to 3.
- Uncheck Use Default Configuration in the webpart properties of the Refinement Panel, section Refinement.
- In the webpart properties of the Refinement Panel in the secion Refinement a value is displayed for Number of
Categories to Display. If the number of categories exceeds this number and the new category is defined last in the XML,
it won’t show up.
SharePoint provides OOTB an easy way to create your own search refiners.
A crawled property, content and some XML to define the filter category are sufficient.