public override System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { if (tokenGroup.GetTotalScore() == 0) { return(originalText); } float score = tokenGroup.GetTotalScore(); if (score == 0) { return(originalText); } // try to size sb correctly System.Text.StringBuilder sb = new System.Text.StringBuilder(originalText.Length + EXTRA); sb.Append("<span style=\""); if (highlightForeground) { sb.Append("color: "); sb.Append(GetForegroundColorString(score)); sb.Append("; "); } if (highlightBackground) { sb.Append("background: "); sb.Append(GetBackgroundColorString(score)); sb.Append("; "); } sb.Append("\">"); sb.Append(originalText); sb.Append("</span>"); return(sb.ToString()); }
public override System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { if (tokenGroup.GetTotalScore() == 0) return originalText; float score = tokenGroup.GetTotalScore(); if (score == 0) { return originalText; } // try to size sb correctly System.Text.StringBuilder sb = new System.Text.StringBuilder(originalText.Length + EXTRA); sb.Append("<span style=\""); if (highlightForeground) { sb.Append("color: "); sb.Append(GetForegroundColorString(score)); sb.Append("; "); } if (highlightBackground) { sb.Append("background: "); sb.Append(GetBackgroundColorString(score)); sb.Append("; "); } sb.Append("\">"); sb.Append(originalText); sb.Append("</span>"); return sb.ToString(); }
public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { if (tokenGroup.GetTotalScore() == 0) { return(originalText); } float score = tokenGroup.GetTotalScore(); if (score == 0) { return(originalText); } System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<font "); if (highlightForeground) { sb.Append("color=\""); sb.Append(GetForegroundColorString(score)); sb.Append("\" "); } if (highlightBackground) { sb.Append("bgcolor=\""); sb.Append(GetBackgroundColorString(score)); sb.Append("\" "); } sb.Append(">"); sb.Append(originalText); sb.Append("</font>"); return(sb.ToString()); }
/* (non-Javadoc) * @see Lucene.Net.Highlight.Formatter#highlightTerm(java.lang.String, Lucene.Net.Highlight.TokenGroup) */ public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { System.Text.StringBuilder returnBuffer; if (tokenGroup.GetTotalScore() > 0) { returnBuffer = new System.Text.StringBuilder(); returnBuffer.Append(preTag); returnBuffer.Append(originalText); returnBuffer.Append(postTag); return(returnBuffer.ToString()); } return(originalText); }
/* (non-Javadoc) * @see Lucene.Net.Highlight.Formatter#highlightTerm(java.lang.String, Lucene.Net.Highlight.TokenGroup) */ public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { System.Text.StringBuilder returnBuffer; if (tokenGroup.GetTotalScore() > 0) { returnBuffer = new System.Text.StringBuilder(); returnBuffer.Append(preTag); returnBuffer.Append(originalText); returnBuffer.Append(postTag); return returnBuffer.ToString(); } return originalText; }
public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) { if (tokenGroup.GetTotalScore() == 0) return originalText; float score = tokenGroup.GetTotalScore(); if (score == 0) { return originalText; } System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<font "); if (highlightForeground) { sb.Append("color=\""); sb.Append(GetForegroundColorString(score)); sb.Append("\" "); } if (highlightBackground) { sb.Append("bgcolor=\""); sb.Append(GetBackgroundColorString(score)); sb.Append("\" "); } sb.Append(">"); sb.Append(originalText); sb.Append("</font>"); return sb.ToString(); }