Tuesday, November 15, 2011

Add Managed Metadata Property - Sharepoint search

Follow the below steps to add a custom managed metadata property.


1. Go to Central Administration, select Application management and select your shared services website.
2. In the search section, click search settings.
3. In the crawl settings section, click metadata property mappings.
4. Click New managed property.
5. Type the name of the managed property you want to create.
6. Remember to run a full crawl before this step.
7. Click Add Mapping to add a mapping to the list.
8. The crawled property selection dialog box appears, Select 'All categories', type few characters of your property, click on Find. Select the crawled property to be mapped to the managed property.
9. Click OK.
10. Click on 'Use in scopes' if you want this managed property to be used in defining scopes.
11. Click on 'OK'

This metadata property can now be used in the search refinements web part to refine your search.

Add search refiners to your search

First create your custom managed properties from central admin. I created two - Division & Department.


1.Put the page in edit mode.
2.Choose the drop down menu for “Refinement Panel” and choose Edit Web Part.
3.Open the Refinement section and uncheck the “Use Default Configuration” checkbox. Then edit “Filter Category Definition” xml as follows.
4. Collapse inner tags
5. Under filtercategories, below the second section, add the below line
category Title="Division" Description="Refinement of the Division" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="1" NumberOfFiltersToDisplay="4" MaxNumberOfFilters="20" ShowMoreLink="True" MappedProperty="Division" MoreLinkText="show more" LessLinkText="show fewer"
6. Make sure the metadatathreshold value is not greater than your search result.
7. Similary add tags for all your managed properties.
8. If you want to add count, add ShowCounts="Count" at the end of the tag.