Highlighter.Net 2.0.0

Highlighter.GetBestFragment Method (TokenStream, String)

Highlights chosen terms in a text, extracting the most relevant section. The document text is analysed in chunks to record hit statistics across the document. After accumulating stats, the fragment with the highest score is returned

public string GetBestFragment(
   TokenStream tokenStream,
   string text
);

Parameters

tokenStream
a stream of tokens identified in the text parameter, including offset information. This is typically produced by an analyzer re-parsing a document's text. Some work may be done on retrieving TokenStreams more efficently by adding support for storing original text position data in the Lucene index but this support is not currently available (as of Lucene 1.4 rc2).
text
text to highlight terms in

Return Value

highlighted text fragment or null if no terms found

See Also

Highlighter Class | Lucene.Net.Highlight Namespace | Highlighter.GetBestFragment Overload List