Friday, March 25, 2011

Have search results display the filename of a word doc, instead of the Title Metadata in SharePoint 2010 !

Below are the steps for customizing search result:
Step#1: Site Action --> Edit Page

Step#2: Find Search Core Results Webpart --> Edit Web Part.

Step#3: Go to Display Properties --> Fetched Properties Text box --> <Column Name="Title"/> replace with <Column Name="FileName"/>

Step#4: Click on XSL Editor... Button -->
follow below steps:
1)


<xsl:value-of select="@title"/>
replace with below code


<xsl:value-of select="@filename"/>
2)
<a href="{$url}" id="{concat('CSR_',$id)}" title="{title}">
replace with below code


<a href="{$url}" id="{concat('CSR_',$id)}" title="{filename}">

3)
<xsl:value-of select="title"/>
replace with below code
<xsl:value-of select="filename"/>
4)


<xsl:value-of disable-output-escaping="yes" select="srwrt:HtmlAttributeEncode(title)" />
replace with below code

<xsl:value-of disable-output-escaping="yes" select="srwrt:HtmlAttributeEncode(filename)" />

5)

<xsl:value-of select="srwrt:HtmlEncode(title)"/>
replace with below code


<xsl:value-of select="srwrt:HtmlEncode(filename)"/>




6)

<xsl:attribute name="title">
replace with below code

<xsl:attribute name="filename">

7)
<xsl:value-of select="title"/>
replace with below code
<xsl:value-of select="filename"/>

8)

<xsl:value-of select="title"/>
replace with below code

<xsl:value-of select="filename"/>


3 comments:

  1. great post, just what i needed !!
    thx for sharing

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This works great!!! The other fixes I've seen are for outdated code in display properties

    ReplyDelete