Consider this; users want to be able to see the Document Type name for each search result item. In addition, users want to remove the URL listed at the bottom of the summary section of the search result item. The URL confuses the user and prevents easy reading of the summary document. To address this issue, add the Document Type managed property to the displayable properties of the Web Part. We have to modify the XSLT transformation XML to display this property in the search results. Finally, modify the XSLT so the document's URL is not displayed.
Add the Document Type managed property to the displayable properties of the Search Core Results Web Part.
- Navigate to your web site.
- Click Site Actions, and then click Edit Page.
- Locate the Bottom zone in the Web Part page.
- Locate the Search Core Results Web Part.
- Hover your mouse over the upper-right corner of the Web Part until a down arrow displays. Click the down arrow to display the Web Part menu.
- Click Edit Web Part.
- Locate page the Search Core Results tool pane in the upper right corner of the Web Part.
- Expand the Display Properties section.
- Uncheck the Use Location Visualization check box.
- Copy the text in the Fetched Properties text box into Notepad.
- Add <Column Name="DocumentType"/> to the end of the text before closing the </Columns> XML element.
- Replace the existing text with a copy of all the text from Notepad to the Fetched Properties text box in the Search Core Results Web Part.
- Click the Apply button.
- Check and then uncheck the Use Location Visualization check box to enable the XSL Editor button for the next exercise.
Modify the XSLT Transformation XML to Display the Document Type Managed Property in the Search Results
- Click the XSL Editor button to open the XSLT transformation XML.
- Locate the <div class="srch-Metadata2"> element in the editor.
- Insert the following XSL template at the indicated location:
<xsl:call-template name="DisplayString">
<xsl:with-param name="str" select="documenttype" />
</xsl:call-template>
- Click the Save button.
- Click the OK button from the Search Core Results tool pane.
- Click the Save and Close ribbon button to save and close the results.aspx page.
Modify the XSLT Transformation XML to Remove the URL from the Search Results Metadata
- Click the XSL Editor button to open the XSLT transformation XML.
- Locate the <p class="srch-Metadata1"> element in the editor.
- Remove the span element as indicated by the highlight.
- Click the Save button.
- Click the OK button of the Search Core Results tool pane.
- Click the Save and Close ribbon button to save and close the results.aspx page.
- Type Microsoft in the Search box and execute a search to see the content type in the summary section of the results. Note that the URL is not displayed at the bottom of the metadata summary.