Export (0) Print
Expand All

Customizing Enterprise Search Results

SharePoint 2007

After you enter a query in the search box, the browser is redirected to the search results page. Your query terms are passed to this page as part of the URL's query string. For example:

http://Site/SearchCenter/Pages/results.aspx?k=sharepoint&s=All%20Content

The search query is submitted to the search component from a hidden object that is instantiated by the Search Core Results Web Part on this page. The hidden object then returns the search results from the search component to the results page for display. The search results data can include the following:

  • Relevant results

  • High confidence results

  • Keywords and best bets results

  • Query statistics

Search Results Layout

The results page is a combination of several Web Parts, each responsible for a view of the results, or information about the results, for the search query that is entered by the user.

The search results are returned by the hidden object as XML data. The hidden object then passes the search results XML data to the different search Web Parts on the results page. The content and format of the XML data that is passed depends on the Web Part that is receiving the data. Each Web Part then displays the XML data, formatted according to the XSL Transform specified for that Web Part's XSL property.

Customizing the Search Results Layout

The Search Results Web Part classes are found in the Microsoft.Office.Server.Search.WebControls namespace. However, these classes are sealed, so you cannot create a Web Part that inherits from them to customize the functionality.

To customize how the search results page appears, you have the following options:

  • Edit the search results page layout in Design mode.

  • Edit any of the search result Web Parts' properties in the Web Part tool pane.

    For more information about this option, see Enterprise Search Core Results XSLT Transformation.

  • Create custom cascading style sheet classes for the results page to use.

You can also create additional results pages, and use the existing search results Web Parts on the page. The same customizations are available.

If the level of customization that you need to perform for the results view is not possible through the options listed previously, you must create a custom Web Part that communicates directly with the Microsoft.Office.Server.Search.Query object model, and that manages the display of the search results data.

For more information about custom Web Parts, see Building Custom Enterprise Search Web Parts.

For more information about using the Enterprise search Query object model, see Getting Started with the Search Query Object Model.

Search Result Items

The actual search results are displayed using three of the Web parts in Figure 1:

  • Search Core Results. Displays relevant results for user's search query.

  • Search High Confidence Results [1]. Displays High Confidence results.

  • Search High Confidence Results [2]. Displays keyword definitions and best bet links if there are any for the search terms.

These Web Parts are actually instances of the same Web Part, the CoreResultsWebPart class in the Microsoft.Office.Server.Search.WebControls namespace. The difference is in the results data that is passed to them, and the XSLT used to format those results.

The following list identifies some customizations that you can make by modifying the search results XSLT:

  • Add or remove properties for retrieval and display.

  • Customize how the properties are displayed in the individual result items.

  • Customize the hit-highlighting style for the result items.

  • Customize the message that is displayed when the search provider did not return any results for the user's query.

For more information about the search results XSLT Transform code, see the topics in the Search Results XSL Overview section.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft