Highlights chosen terms in a text, extracting the most relevant sections. The document text is analysed in chunks to record hit statistics across the document. After accumulating stats, the fragments with the highest scores are returned as an array of strings in order of score (contiguous fragments are merged into one in their original order to improve readability)

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

Syntax

C#
public string[] GetBestFragments(
	TokenStream tokenStream,
	string text,
	int maxNumFragments
)
Visual Basic
Public Function GetBestFragments ( _
	tokenStream As TokenStream, _
	text As String, _
	maxNumFragments As Integer _
) As String()
Visual C++
public:
array<String^>^ GetBestFragments(
	TokenStream^ tokenStream, 
	String^ text, 
	int maxNumFragments
)

Parameters

tokenStream
Type: Lucene.Net.Analysis..::..TokenStream

[Missing <param name="tokenStream"/> documentation for "M:Lucene.Net.Highlight.Highlighter.GetBestFragments(Lucene.Net.Analysis.TokenStream,System.String,System.Int32)"]

text
Type: System..::..String
text to highlight terms in
maxNumFragments
Type: System..::..Int32
the maximum number of fragments.

Return Value

highlighted text fragments (between 0 and maxNumFragments number of fragments)

See Also