Monday, January 7, 2008

Displaying the most relevant refinements



Over the past year, a number of you have asked to show only the matching refinements above Custom Search results. Today we're announcing that very feature: You can have as many FacetItems as you like in the XML definition of your CSE and control the number that display on a search page using this feature. Just add a "top_refinements" attribute to your context definition's CustomSearchEngine tag.

<CustomSearchEngine top_refinements="n">
</CustomSearchEngine>

Where n is the number of refinements you want to show.

For example, consider the context definition of a CSE I created: http://vrishali.googlepages.com/food_context.xml. It has sixteen FacetItems -- however, the top_refinements is set to 4. This means that it will display the top four matching refinements for every query. Check out the query chicken. Observe how the refinements displayed at the top are different for the query food safety.

Now consider the default implementation of the same CSE, that is without the top_refinements option: http://vrishali.googlepages.com/food_context_no_top_refinements.xml. All queries in this search engine will display the same refinements, for example chicken and food safety.

This feature is enabled for Linked CSEs as well as Google stored CSEs. To use it in your Google Stored CSE, download the context file in the "Advanced" tab of your control panel, add the "top_refinements" attribute to the CustomSearchEngine tag in your XML and upload the modified file.

If you don't want to display refinements at the top of the search results, turn them off by setting top_refinements="0". Your search results will still be labeled with the refinements that match.

As always, let us know what you like, or don't like, about this feature!