Hides implementation issues associated with obtaining a TokenStream for use
with the higlighter - can obtain from TermFreqVectors with offsets and
(optionally) positions or from Analyzer class reparsing the stored content.

Exception thrown if TokenStream Tokens are incompatible with provided text

Package org.apache.lucene.search.highlight Description

The highlight package contains classes to provide "keyword in context" features
typically used to highlight search terms in the text of results pages.
The Highlighter class is the central component and can be used to extract the
most interesting sections of a piece of text and highlight them, with the help of
Fragmenter, fragment Scorer, and Formatter classes.

New features 06/02/2005

This release adds options for encoding (thanks to Nicko Cadell).
An "Encoder" implementation such as the new SimpleHTMLEncoder class can be passed to the highlighter to encode
all those non-xhtml standard characters such as & into legal values. This simple class may not suffice for
some languages - Commons Lang has an implementation that could be used: escapeHtml(String) in
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=137958&view=markup

New features 22/12/2004

This release adds some new capabilities:

Faster highlighting using Term vector support

New formatting options to use color intensity to show informational value

Options for better summarization by using term IDF scores to influence fragment selection

The highlighter takes a TokenStream as input. Until now these streams have typically been produced
using an Analyzer but the new class TokenSources provides helper methods for obtaining TokenStreams from
the new TermVector position support (see latest CVS version).

The new class GradientFormatter can use a scale of colors to highlight terms according to their score.
A subtle use of color can help emphasise the reasons for matching (useful when doing "MoreLikeThis" queries and
you want to see what the basis of the similarities are).

The QueryScorer class has a new constructor which can use an IndexReader to derive the IDF (inverse document frequency)
for each term in order to influence the score. This is useful for helping to extracting the most significant sections
of a document and in supplying scores used by the new GradientFormatter to color significant words more strongly.
The QueryScorer.getMaxWeight method is useful when passed to the GradientFormatter constructor to define the top score
which is associated with the top color.