How to: Change the Properties Returned in the Core Search Results
The metadata schema of search component may contain custom properties that you want to include in the returned core search results. To display values from custom properties on the search results page you must modify the Core Search Results Web Part's properties to:
Add the custom property to the search query
Modify the XSLT to display the custom property.
Note
Only managed properties are available for search queries. If the custom property is a crawled property, you must map it to a managed property for these steps to work. For more information, see Managing Metadata.
To add a property to the search query
With the search results page open in the browser, click the Site Actions menu, and then click Edit Page Content.
After the page opens in Edit mode, click the drop-down arrow for the Core Search Results Web Part to open the Web Partmenu, and then click Modify Shared Web Part. The tool pane so you can modify the Web Part's properties.
Expand the Results Query Options node, and click in the Selected Columns box. Click the ellipsis ("…") button to open the Text Entry window for the Selected Columns property.
Add a tag with the managed property name within the <SelectedColumns> section, using the following syntax:
<Column Name="PropertyName"/>
Save the changes to the Web Part by clicking OK or Apply.
At this point the property value should be included in the search results returned. You can verify this using the steps described in How to: View Search Results XML Data.
Note
To display the property as part of the search results, you must modify the Web Part's XSL property.
To modify the Web Part's XSLT to include the new property
Repeat steps 1 and 2 from the preceding procedure.
Expand the Miscellaneous node, and then click in the XSL property box. To open the XSL property Text Entry window, click the ellipsis ("…") button that appears.
Copy the contents of the window into an XML editor, where you will modify the XSLT code to display the custom property.
The modifications you make depend on how you want to display the property. For example, you could display the custom property with the Author and LastModified property, using the same format.
Use the DisplayString template to transform the XML for these properties. To locate the <xsl:call-template> element for these properties, search for the following string:
call-template name="DisplayString"
In this section add the
<xsl:call-template>
element for the new property, copying the syntax used for either the Author or LastModified property.Use the following syntax:
<xsl:call-template name="DisplayString"> <xsl:with-param name="str" select="CustomProperty" /> <xsl:with-param name="prop">Custom Property:</xsl:with-param> </xsl:call-template>
Alternatively, you could create a new template for the custom property, and specify this template using the
<xsl:call-template>
element. For more information about this process, see the MSDN <xsl:template> element reference.
See Also
Tasks
How to: View and Edit the Search Results XSLT Transformation
How to: View Search Results XML Data
Concepts
Customizing Enterprise Search Results
Enterprise Search Core Results XSLT Transformation