4

I am trying to develop a customized SharePoint 2010 web part for FAST search. I am using Microsoft.Office.Server.Search.Query.KeywordQuery something like this:

var FASTquery = new KeywordQuery(proxy)
{
    ResultsProvider = SearchProvider.FASTSearch,
    QueryText = queryText,
    ResultTypes = ResultType.RelevantResults | ResultType.RefinementResults
};
FASTquery.SelectProperties.AddRange(
    new string[] { "Title", /* ..., */ "HitHighlightedSummary" });
ResultTableCollection searchResults = FASTquery.Execute();

I go on to bind searchResults[ResultType.RelevantResults] to a Repeater control. I'm trying to get the "hit highlighted summary" to appear by calling FASTquery.HighlightStringValue(). The value I'm passing is the HitHighlightedSummary from searchResults. An example of what this looks like for a result when searching for "ear" is:

<ddd/>FALSE ); GetDlgItem(IDC_<c0>EAR</c0>_PAIN_STATIC)-&gt;EnableWindow<ddd/>FALSE ); GetDlgIte(IDC_<c0>EAR</c0>_PAIN_ABSENT_RADIO<ddd/>FALSE ); GetDlgItem(IDC_<c0>EAR</c0>_PAIN_MILD_RADIO<ddd/>

However, when called with a string like this, FASTquery.HighlightStringValue() is throwing a System.ServiceModel.FaultException with the message "Value does not fall within the expected range."

What is the correct way to convert this excerpt to HTML, or should I be calling HighlightStringValue() with some other value? The documentation is not particularly helpful.

recursive
  • 83,943
  • 34
  • 151
  • 241

1 Answers1

8

I typically perform a manual conversion of the hit highlighted summary markup to HTML. You'll find a combination of two markers in the summary:

  • <c0> </c0> (Highlight)
  • <ddd/> (Ellipsis)

A manual transformation of the markup could be as simple as the following string replacement:

string hitHighilghtedSummary;
// ...

hitHighlightedSummary = hitHighlightedSummary.Replace("c0", "strong").Replace("<ddd/>", "&#8230;");
cbanner
  • 91
  • 1
  • 3