Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've recently found that when a user searches for a phrase in double quotes, the results page is highlighting individual words from within the phrase that may not actually match the full quoted phrase. This can make it difficult for the user to decide which document in the results list is the one they're looking for.

SharePoint 2007 does appear to be correctly filtering the results based on the complete phrase, it's just the highlighting that's off. For that matter, the text blurb that's shown in the results is also often not useful since it's based on the highlighted word.

Does anyone have any suggestions on how to fix this?

share|improve this question

1 Answer 1

The highlighted words in the search results comes from the .xslt used in the search results transformer. You can see this .xslt when you edit the properties of the search results web part.

I imagine it's possible to do what you're asking but you may want to temporarily switch the search results over to raw XML and then you'll see how the search-terms are passed to the results transform which then applies a template to create the highlighting effect.

The xslt to output raw XML search results would look like:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
    <xsl:template match="/">
        <xmp>
            <xsl:copy-of select="*" />
        </xmp>
    </xsl:template>
    <!-- End of Stylesheet -->
</xsl:stylesheet>

I realize that this is more of a tip than an answer but i hope it helps you discern why you're getting the highlighting that you're seeing.

share|improve this answer
    
Thanks for the tip but I don't see anything in the XML results that will help. There's a <hithighlightedsummary> element for each result that shows the same summary text as the results page, with highlights indicated inline by wrapping the highlighted text in a <c0> element. –  Mike Powell Jul 28 '10 at 18:25
    
FYI line 4 of your XSLT should read "<xsl:template match="/">. –  Mike Powell Jul 28 '10 at 18:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.