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

Namespace: Lucene.Net.Highlight
Assembly: Lucene.Net.Contrib.Highlighter (in Lucene.Net.Contrib.Highlighter.dll) Version: 2.3.2.1

Syntax

C#
public string GetBestFragment(
	TokenStream tokenStream,
	string text
)
Visual Basic
Public Function GetBestFragment ( _
	tokenStream As TokenStream, _
	text As String _
) As String
Visual C++
public:
String^ GetBestFragment(
	TokenStream^ tokenStream, 
	String^ text
)

Parameters

tokenStream
Type: Lucene.Net.Analysis..::..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
Type: System..::..String
text to highlight terms in

Return Value

highlighted text fragment or null if no terms found

See Also