Share via


Working With the Search Results Web Part

You use the Search Results Web Part to display search results. The Web Part has two configurable tabbed views that can display either the Catalog search results or the Site Content search results. Site Content searches use Microsoft Enterprise Search or Microsoft Search Server 2008.

An XSL template drives the Search Results Web Part.

Web Part

The following figures show the Search Results Web Part.

The first tabbed view displays Product Query search results in the following format:

Dd452299.Vug_SearchResults_T1_WebPart(en-US,CS.90).gif

The second tabbed view displays Site Content search results in the following format:

Dd452299.Vug_SearchResults_T2_WebPart(en-US,CS.90).gif

Property Sheet

The following figures show the Search Results Web Part property sheet. The Search Results Web Part property sheet lets site designers control some aspects of the Web Part's behavior and appearance. The property sheet is displayed by selecting the edit option on the Web Page (in Edit Page mode) and then selecting Modify Shared Web Part. This displays the property sheet. Expand the sections to see the relevant properties.

The following figure shows the Commerce properties for the Search Results Web Part.

Dd452299.Vug_SearchResults_WebPart_CommerceProps(en-US,CS.90).gif

The following figure shows the Appearance properties for the Search Results Web Part.

Dd452299.Vug_SearchResults_WebPart_AppearanceProps(en-US,CS.90).gif

The following figure shows the Advanced properties for the Search Results Web Part.

Dd452299.Vug_SearchResults_WebPart_AdvancedProps(en-US,CS.90).gif

Properties

The following table lists and describes the properties for the Search Results Page Web Part.

Name

Description

Type

Default value

Category to search

String

Sets the name of the product category that will be searched if the setting "Phase to search" is not empty.

Blank

(Tab 1) Content type

Enum

Sets the content type that will be displayed by this tab.

ProductCatalog

(Tab 1) # of results per page

Int

Sets the number of results to display per page.

10

(Tab 1) Properties to retrieve

String

Sets a semi-colon ';' separated list of Commerce Foundation "Product" properties that will be retrieved as the result of the search.

Id;DisplayName;Description;

(Tab 1) Sorting Properties

String

Specifies the available sorting options using a custom XML-based configuration.

The default value is:

<SortOptionItems>

<SortOption Name="ListPriceDesc" DataItem="ListPrice" AscOrder="false" DisplayText="List Price (Highest to lowest)"/>

<SortOption Name="ListPriceAsc" DataItem="ListPrice" AscOrder="true" DisplayText="List Price (Lowest to highest)" />

<SortOption Name="DisplayName" DataItem="DisplayName" AscOrder="true" DisplayText="Product Name" />

</SortOptionItems>

Where:

<SortOption> specifies a field that can be sorted

@Name is a unique name

@DataItem is the property to sort on

@AscOrder represents the sort direction, true for ascending, false for descending

@DisplayText is the option's text that is visible to the user

<SortOptionItems>

<SortOption Name="ListPriceDesc" DataItem="ListPrice" AscOrder="false" DisplayText="List Price (Highest to lowest)"/>

</SortOptionItems>

(Tab 1) Query filter

String

Sets an SQL-like "Where" clause that will filter results.

Blank

(Tab 1) Default sorting property

String

Sets the name of the property to use when sorting displayed results.

ListPrice

(Tab 2) Content type

Enum

Sets the content type that will be displayed by this tab.

SiteContent

(Tab 2) # of results per page

Int

Sets the number of results to display per page.

10

(Tab 2) Properties to retrieve

String

Sets a semi-colon ';' separated list of Commerce Foundation "Product" properties that will be retrieved as the result of the search.

workid;rank;title;size;path;

(Tab 2) Sorting properties

String

Specifies the available sorting options using a custom XML-based configuration.

The default value is:

<SortOptionItems>

<SortOption Name="ListPriceDesc" DataItem="ListPrice" AscOrder="false" DisplayText="List Price (Highest to lowest)"/>

<SortOption Name="ListPriceAsc" DataItem="ListPrice" AscOrder="true" DisplayText="List Price (Lowest to highest)" />

<SortOption Name="DisplayName" DataItem="DisplayName" AscOrder="true" DisplayText="Product Name" />

</SortOptionItems>

Where:

<SortOption> specifies a field that can be sorted

@Name is a unique name

@DataItem is the property to sort on

@AscOrder represents the sort direction, true for ascending, false for descending

@DisplayText is the option's text that is visible to the user

<SortOptionItems>

<SortOption Name="ListPriceDesc" DataItem="ListPrice" AscOrder="false" DisplayText="List Price (Highest to lowest)"/>

</SortOptionItems>

(Tab 2) Query filter

String

Sets an SQL-like "Where" clause that will filter results.

Blank

(Tab 2) Default sorting property

String

Sets the name of the property to use when sorting displayed results.

rank

"No results" XSL template

String

Sets the path of the XSL template used to generate the HTML markup when no results are returned by the search.

<xsl:stylesheet

"No records found" text

String

Sets the text displayed when the search returns no results.

No Records Found For Your Search

(Tab 1) Template

String

Sets the path of the XSL template used to generate the HTML markup.

<xsl:stylesheet

(Tab 1) "Active" indicator image URL

String

Sets the file URL for the image that will be used to indicate that the tab is "active".

Blank

(Tab 1) "Inactive" indicator image URL

String

Sets the file URL for the image that will be used to indicate that the tab is "inactive".

Blank

(Tab 1) Tab display name

String

Sets the text displayed as the tab's name.

Products Search Results

(Tab 1) "No results found" text

String

Sets the text displayed when no results are found.

No Products Found For Your Search

(Tab 2) Template

String

Sets the path of the XSL template used to generate the HTML markup.

<xsl:stylesheet

(Tab 2) "Active" indicator image URL

String

Sets the file URL for the image that will be used to indicate that the tab is "active".

Blank

(Tab 2) "Inactive" indicator image URL

String

Sets the file URL for the image that will be used to indicate that the tab is "inactive".

Blank

(Tab 2) Tab display name

String

Sets the text displayed as the tab's name.

Site Content Search Results

(Tab 2) "No results found"

String

Sets the text displayed when no results are found.

No Site Contents Found For Your Search

SharePoint Site Search Target URL

String

Sets the URL of the SharePoint site that will be used as context when performing the SharePoint site content search. This is usually the root URL of the current site.

Blank

Phrase to search

String

Sets the phrase to search. Setting this field causes this Web Part to ignore search parameters, always searching using this phrase and the value of "Category to search" instead.

Blank

Sharepoint search scopes

String

Sets the SharePoint search scopes to use. This must be a semi-colon ";" separated list of recognized SharePoint scopes. To see or configure the list of scopes, go to Central Admin then Shared Services then Search Settings then Scopes. From there you can view or edit search scopes.

Blank

See Also

Other Resources

Working With the Web Parts

Catalog Web Parts

Search Results Web Part