다음을 통해 공유


Adding a Refiner to the Refinement Panel Web Part

Learn how to add a new refiner to your query results in FAST Search Server 2010 for SharePoint.

This article describes how to add a new refiner to your query results, as follows:

In this article
Enable Query Refinement for a Managed Property in the Index Schema
Configure a Custom Query Refiner for the Refinement Panel Web Part
Verify Correct Creation of a Custom Query Refiner

Applies to: SharePoint Server 2010

Enable Query Refinement for a Managed Property in the Index Schema

To use a managed property for query refinement, you must modify the index schema configuration.

The following example shows how you can enable query refinement for a managed property named myproperty.

$mp = Get-FASTSearchMetadataManagedProperty -Name myproperty
$mp.RefinementEnabled=1
$mp.Update()
$mp

Ensure that the managed property has the attribute Queryable set to true.

When you test the refiner, it is convenient to return the managed property data in query results. Verify that the managed property has the attribute SummaryType set to Static.

If you enable query refinement for an extracted property, you should ensure that the managed property has the attribute MergeCrawledProperties set to true. This setting enables multiple refinement choices for each item.

Important

For the query refiner to appear in search results, you must re-crawl the content.

Configure a Custom Query Refiner for the Refinement Panel Web Part

To see the custom query refiner in the search UI, you must configure the refiner in the Refinement Panel Web Part.

Note

You must have administrator rights in the SharePoint farm to edit the search result Web Part.

You can define a maximum of six refiners on the search results page. If you define more than six, the refiners listed last in the Filter Category Definition are not shown.

To configure a custom query refiner for the Refinement Panel Web Part

  1. In your browser, navigate to the query results page. The URL typically looks as follows:

    http://SiteURL/Pages/results.aspx

  2. On the Site Actions menu, click Edit Page.

  3. In the Refinement Panel Web Part, click the edit arrow to display the Web Part menu, and then click Edit Web Part. This opens the Web Part tool pane.

  4. In the Refinement section, clear the Use Default Configuration check box.

  5. In the Refinement section, click the Filter Category Definition field and then click the ellipsis (…) button.

    This opens the Text Entry window for the Refinement Web Part's FilterCategoriesDefinition property. You can modify the XML directly in this window. However, you may find it easier to copy the code to a file. You can then edit that file by using an application such as Microsoft Visual Studio 2010.

  6. You must add your custom refiner to the definition. The following is an example of an XML element for a refiner named myproperty with the title My property. You can add the definition before the end tag for the FilterCategories element to have the refiner appear at the end of the query refinement section on the result page.

    <Category Title="My property"
              Description="Use this filter to restrict results by items related to values in myproperty"
              Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator"
              MetadataThreshold="1"
              NumberOfFiltersToDisplay="4"
              MaxNumberOfFilters="20"
              ShowMoreLink="True"
              MappedProperty="myproperty"
              MoreLinkText="show more"
              LessLinkText="show fewer"
              ShowCounts="Count"/>
    

    For more information about the refiner properties, see the XML schema definition of the Category [Refinement] element.

  7. After you finish editing the file, you can copy the modified XML back into the Text Entry window and save your changes to the Web Part.

Verify Correct Creation of a Custom Query Refiner

If your custom query refiner does not appear correctly in the Web Part, you should first verify that the query results from FAST Search Server 2010 for SharePoint include data in the managed property that you have created for the property extractor, and that the correct data is returned for the associated refiner. A simple way to do this is by issuing a query using a Windows PowerShell script.

You must ensure that you have one or more indexed items that contain data in the managed property associated with the query refiner.

Use the Windows PowerShell script specified in Testing Custom Query Features.

Based on the output, you can verify the following:

  • Whether the managed property was created

  • Whether the mapping of the crawled property was performed correctly

  • Whether the query refinement was configured correctly

If the refiner data is printed, but does not appear in the refinement panel, then you must verify that the refinement panel configuration is correct.

If the refiner is not printed, then you must verify that the index schema configuration is correct and re-crawl some items that contain any value for the managed property.

See Also

Concepts

Refinement Panel XML Schema

Debugging Custom Item Processing

Other Resources

Manage Managed Properties by Using Windows PowerShell