Geeks With Blogs

News These postings are provided "AS IS" with no warranties, and confers no rights.
Locations of visitors to this page virtusa corp sharepoint virtusa.com shehan peruma

Shehan Peruma
OOTB the Search Core Results webpart simply emphasizes the search string you entered in the Search Box by wrapping it within the <b></b> tags. But let’s say you need to highlight the search terms in different colors; what do you do? Write a new results webpart? No! you only need to adjust the Search Core Results  XLS.

This is how it’s done:

  • Open up the XLS editor and copy the contents  to notepad or some other  editor (if your fine with editing it in the MOSS’s default editor, go right ahead)
  • Search for the term <xsl:template match="ddd">
  • Just below that you will see :
 <xsl:template match="c0">

<b><xsl:value-of select="."/></b>

</xsl:template>

<xsl:template match="c1">

<b><xsl:value-of select="."/></b>

</xsl:template>

And this goes on till “c9”. The values “c0” to “c9” correspond to the search terms you entered, where “c0” is the first, “c1” is the second and so on…

  • Replace this with something like:
  <xsl:template match="c0">

    <strong style="background-color: #CCCCFF">

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

    </strong>

  </xsl:template>

  <xsl:template match="c1">

    <strong style="background-color: #CCFFFF">

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

    </strong>

As you can see I’ve used the style “background-color” to give each search term its own color.
  •  Once done copy the updated XLS file back to the webpart and save

Searching for "microsoft sharepoint server"

with the default XLS:
with default XLS






with the modified XLS:

Posted on Thursday, February 21, 2008 1:38 PM MOSS , Search , Branding , Administration & Configuration | Back to top


Comments on this post: Highlight Search Results

# re: Highlight Search Results
Requesting Gravatar...
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the collegea, and it has same topic with your article. Thanks, great share.

Thanks
H&M Shopping Online
Left by Shopping Online Guides on Feb 17, 2011 9:39 AM

# re: Highlight Search Results
Requesting Gravatar...
Thank you for this blog. Thats all I can say. You most definitely have made this blog into something thats eye opening and important. You clearly know so much about the subject, youve covered so many bases. Great stuff from this part of the internet. Again, thank you for this blog.Thanks
Left by thomasville home office furnitur on Nov 14, 2011 8:03 AM

Your comment:
 (will show your gravatar)


Copyright © shehan | Powered by: GeeksWithBlogs.net