Search
Windows Server

SharePoint 2010 : Configuring Search Settings and the User Interface - Web Parts (part 4)

Published 5 min readBy Programming4us Editorial Team

Refinement Panel

A new Web Part in SP2010 is the Refinement Panel Web Part, also known as the refinement panel. The Web Part allows users to drill down through the set of search results based upon managed properties, metadata, and other criteria. One thing to pay attention to is that refiners in SharePoint 2010 are not deep refiners. They are based on analysis of a subset of the full result set. Only FAST offers deep refiners. In this section, we will look at the following search-related settings (Figure 18) of the refinement panel: “General refiner settings,” “Adding custom refinements from managed metadata columns,” and “Adding custom refinements from managed properties.”

Figure 18. Refinement Panel settings

To the left of Figure 19, the set of refinements that is available out of the box is shown. These are all preconfigured in SharePoint 2010. There are a number of refinements built in, including file type, site, author, modified date, and taxonomy keywords (if any are available).

Figure 19. Example of default refiners in SP2010

General Refiner Settings

The refiner Web Part has some powerful settings (Figure 20) allowing easy implementation of custom refinement categories based on managed metadata columns and managed properties.

Figure 20. Refinement configuration

The Filter Category Definition property is a XML field where each category is specified.

The accuracy index is the number of results it looks at to determine things to refine. What this does mean is that if there is something unique to refine on but it doesn't occur until result number 51, then it will not be included. The accuracy index has a hard-coded upper limit of 500 to avoid excessive resource usage.

The maximum number of categories to display can be specified. This is set to six by default. Exclusion will be performed by the ordering of the categories in the Filter Category Definition.

The Use Default Configuration check box controls if default or custom values will be used.

Note The Use Default Configuration check box must be unchecked when modifying the filter category definition and other settings. Otherwise any edited settings will not take effect.

Adding a Refiner Category from Managed Metadata Columns

It is very easy to add a new refiner category if the column type is managed metadata. In this case, the SharePoint search engine will automatically create managed properties out of the crawled properties. The only manual step included is to add the appropriate XML to the Refinement Panel Filter Category Definition XML file. It is possible to set many more options than the ones shown in Listing 1.

Listing 1. XML for Managed Metadata Column

<Category Title="Field Name"
Type="Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator"
MappedProperty="ows_MetadataFacetInfo" MoreLinkText="Show More" MetadataThreshold="1"
NumberOfFiltersToDisplay="5"/>

These are the minimum required options in the XML.

  • Title is the name of the column or field that the managed metadata is mapped to. Type has to be set to TaxonomyFilterGenerator for Managed Metadata fields. The mapped property for Managed Metadata fields has to be set to ows_MetadataFacetInfo.

Uncheck the Use Default Configuration option, and execute a search that yields multiple values for the added managed metadata column. In the default Filter Definition Configuration file, two categories are per default defined in this fashion. These are Managed Metadata Columns and Tags. The difference between the two is that the Tags category is used for the enterprise keywords, while the Managed Metadata Columns category is used for managed metadata columns. This means that the refinement panel presents two different sources of data. The managed metadata columns are for filtering based on the data coming from the result set, whereas the tags are used for narrowing the search based on keywords.

Adding a Refiner Category from Managed Properties

If a metadata column is not managed, the crawler needs to be configured to index this column in order to make it available for searching. To accomplish this, a new managed property must be created as follows:

  1. Go to Central Administration => Manage Service Applications => Search Service Application => Metadata Properties.
  2. Create a new managed property. Add a mapping to the crawled property for your column (e.g., ows_custom_0x0020_property), and perform a full crawl on the appropriate content sources.
  3. The crawled property is now mapped to a managed property and can be used in the refinement panel by modifying the Filter Category Definition on the Refiner Web Part.
  4. Add the XML in Listing 2 to the Refinement Panel Filter Category Definition XML file. Uncheck the Use Default Configuration option, and execute a search that yields multiple values for the added managed property.

    Listing 2. XML for Managed Property

    <Category Title="Process Step"
    Description="Process Step of the document"
    Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator"
    MetadataThreshold="5"
    NumberOfFiltersToDisplay="4"
    MaxNumberOfFilters="20"
    ShowMoreLink="True"
    MappedProperty="ProcessStep" />

The following is a brief description of each line in Listing 6-2.

  • Title: This is the name of the category to display.
  • Description: This is the text to be shown as a hint for the filters.
  • Type: This has to be set to ManagedPropertyFilterGenerator for managed properties.
  • MetadataThreshold: This is the minimum required possible options returned for this filter before the category will be displayed.
  • NumberOfFiltersToDisplay: This is the maximum number of possible options to show for this category in default view.
  • MaxNumberOfFilters: This is the maximum number of possible options to collect for this category.
  • ShowMoreLink: Whether a link should be displayed if more than NumberOfFiltersToDisplay is returned
  • MappedProperty: For managed properties, this is the name of the column or field that the managed property is mapped to.

Note If Use Default Configuration is checked, the changes will not be reflected in the refinement panel. This is a typical source of frustration. Also, checking it again will override whatever changes have been made, so always back up any configuration made to XML files.

Why Are the Refiners Not Showing?

When the refiners are not showing as expected, this is often caused by one of the following:

  • A full crawl has not been executed after the managed property has been created.
  • The result set is not big enough to contain data for the relevant column to make the refiner meaningful.
  • The refiners are shown in the order they are defined in the XML. For example, if the new refiner category is placed as category number 7, but the refinement panel is configured to show only the first six categories, it will not be displayed in the panel (if the first six categories are shown).

Note The concept of refiners or faceted search is not part of SharePoint 2007, although a significant number of search centers actually have refiners based on either the faceted search Web Part from CodePlex or the more complex search center offered by the Ontolica product from SurfRay. The latter actually includes numbered refiners for both SP2007 and SP2010.