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
Intro
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.
Create lists
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.
Crawl content
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
When this is finished create a Managed Property called Language and add a mapping to the crawled property ows_Language.
Start a Full Crawl.
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
Start a search on one of the words in the title of one of the documents uploaded in the created Document Library.
Notice the Language refiner on the left.
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
values. - 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.
Summary
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.
Pingback: Tweets die vermelden Search Refiners (part 1) – Expanding the OOTB search Refinement Panel -- Topsy.com
Important tips! I have already been trying to find something like this for some time now. Thanks for the tips!
Pingback: Search Refiners (part 2) – Use of CustomFilters
Pingback: Search Refiners (part 3) – Chart based
SharePoint 2010: Do you know if it’s possible to expand the links within the ‘site’ refinment category by default, so users are displayed with all subsites. Currently users need to click on the site name to see any subsites.
Not all possible subsites are returned by SharePoint to be able to expand the subsites at once. As can be seen by selecting a subsite a whole new query is build, where the sitename is present in the ‘r=’ part.
Therefor I don’t think expanding all subsites can be done by adjusting xml or xslt of the refinementpanel.
Could you please tell if it is possible to refine on the basis of site columns present in content type not the values of site columns.
For example if a user searches 10 and if it clicks siteusage(which is a site column) than user will get all listitem which has siteusage value equal to 10.
Pingback: cinto
Thank’s a lot, Anita. This is the best and most concise description I have found. To edit the XML I used Notepad++ with XML Tools extension to format the XML. In fact, the XML “Editor” provided by SharePoint is not useful at all.