Programmatically generate HTML for HitHighlightedSummary using KeywordQuery in FAST search for SharePoint 2010 -
i trying develop customized sharepoint 2010 web part fast search. using microsoft.office.server.search.query.keywordquery
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 bind searchresults[resulttype.relevantresults]
repeater
control. i'm trying "hit highlighted summary" appear calling fastquery.highlightstringvalue()
. value i'm passing hithighlightedsummary
searchresults
. example of looks result when searching "ear" is:
<ddd/>false ); getdlgitem(idc_<c0>ear</c0>_pain_static)->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 string this, fastquery.highlightstringvalue()
throwing system.servicemodel.faultexception
message "value not fall within expected range."
what correct way convert excerpt html, or should calling highlightstringvalue()
other value? documentation not particularly helpful.
i typically perform manual conversion of hit highlighted summary markup html. you'll find combination of 2 markers in summary:
- <c0> </c0> (highlight)
- <ddd/> (ellipsis)
a manual transformation of markup simple following string replacement:
string hithighilghtedsummary; // ... hithighlightedsummary = hithighlightedsummary.replace("c0", "strong").replace("<ddd/>", "…");
Comments
Post a Comment