|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.highlight.Highlighter
public class Highlighter
Class used to markup highlighted terms found in the best sections of a
text, using configurable Fragmenter
, Scorer
, Formatter
,
Encoder
and tokenizers.
Field Summary | |
---|---|
static int |
DEFAULT_MAX_DOC_BYTES_TO_ANALYZE
|
Constructor Summary | |
---|---|
Highlighter(Formatter formatter,
Encoder encoder,
Scorer fragmentScorer)
|
|
Highlighter(Formatter formatter,
Scorer fragmentScorer)
|
|
Highlighter(Scorer fragmentScorer)
|
Method Summary | |
---|---|
java.lang.String |
getBestFragment(Analyzer analyzer,
java.lang.String fieldName,
java.lang.String text)
Highlights chosen terms in a text, extracting the most relevant section. |
java.lang.String |
getBestFragment(TokenStream tokenStream,
java.lang.String text)
Highlights chosen terms in a text, extracting the most relevant section. |
java.lang.String[] |
getBestFragments(Analyzer analyzer,
java.lang.String text,
int maxNumFragments)
Deprecated. This method incorrectly hardcodes the choice of fieldname. Use the method of the same name that takes a fieldname. |
java.lang.String[] |
getBestFragments(Analyzer analyzer,
java.lang.String fieldName,
java.lang.String text,
int maxNumFragments)
Highlights chosen terms in a text, extracting the most relevant sections. |
java.lang.String[] |
getBestFragments(TokenStream tokenStream,
java.lang.String text,
int maxNumFragments)
Highlights chosen terms in a text, extracting the most relevant sections. |
java.lang.String |
getBestFragments(TokenStream tokenStream,
java.lang.String text,
int maxNumFragments,
java.lang.String separator)
Highlights terms in the text , extracting the most relevant sections and concatenating the chosen fragments with a separator (typically "..."). |
TextFragment[] |
getBestTextFragments(TokenStream tokenStream,
java.lang.String text,
boolean mergeContiguousFragments,
int maxNumFragments)
Low level api to get the most relevant (formatted) sections of the document. |
Encoder |
getEncoder()
|
Scorer |
getFragmentScorer()
|
int |
getMaxDocBytesToAnalyze()
|
Fragmenter |
getTextFragmenter()
|
void |
setEncoder(Encoder encoder)
|
void |
setFragmentScorer(Scorer scorer)
|
void |
setMaxDocBytesToAnalyze(int byteCount)
|
void |
setTextFragmenter(Fragmenter fragmenter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_DOC_BYTES_TO_ANALYZE
Constructor Detail |
---|
public Highlighter(Scorer fragmentScorer)
public Highlighter(Formatter formatter, Scorer fragmentScorer)
public Highlighter(Formatter formatter, Encoder encoder, Scorer fragmentScorer)
Method Detail |
---|
public final java.lang.String getBestFragment(Analyzer analyzer, java.lang.String fieldName, java.lang.String text) throws java.io.IOException
getBestFragment(TokenStream, String)
analyzer
- the analyzer that will be used to split text
into chunkstext
- text to highlight terms infieldName
- Name of field used to influence analyzer's tokenization policy
java.io.IOException
public final java.lang.String getBestFragment(TokenStream tokenStream, java.lang.String text) throws java.io.IOException
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
java.io.IOException
public final java.lang.String[] getBestFragments(Analyzer analyzer, java.lang.String text, int maxNumFragments) throws java.io.IOException
getBestFragments(TokenStream, String, int)
analyzer
- the analyzer that will be used to split text
into chunkstext
- text to highlight terms inmaxNumFragments
- the maximum number of fragments.
java.io.IOException
public final java.lang.String[] getBestFragments(Analyzer analyzer, java.lang.String fieldName, java.lang.String text, int maxNumFragments) throws java.io.IOException
getBestFragments(TokenStream, String, int)
analyzer
- the analyzer that will be used to split text
into chunksfieldName
- the name of the field being highlighted (used by analyzer)text
- text to highlight terms inmaxNumFragments
- the maximum number of fragments.
java.io.IOException
public final java.lang.String[] getBestFragments(TokenStream tokenStream, java.lang.String text, int maxNumFragments) throws java.io.IOException
text
- text to highlight terms inmaxNumFragments
- the maximum number of fragments.
java.io.IOException
public final TextFragment[] getBestTextFragments(TokenStream tokenStream, java.lang.String text, boolean mergeContiguousFragments, int maxNumFragments) throws java.io.IOException
tokenStream
- text
- maxNumFragments
- mergeContiguousFragments
-
java.io.IOException
public final java.lang.String getBestFragments(TokenStream tokenStream, java.lang.String text, int maxNumFragments, java.lang.String separator) throws java.io.IOException
text
- text to highlight terms inmaxNumFragments
- the maximum number of fragments.separator
- the separator used to intersperse the document fragments (typically "...")
java.io.IOException
public int getMaxDocBytesToAnalyze()
public void setMaxDocBytesToAnalyze(int byteCount)
byteCount
- the maximum number of bytes to be tokenized per doc
(This can improve performance with large documents)public Fragmenter getTextFragmenter()
public void setTextFragmenter(Fragmenter fragmenter)
fragmenter
- public Scorer getFragmentScorer()
public void setFragmentScorer(Scorer scorer)
scorer
- public Encoder getEncoder()
public void setEncoder(Encoder encoder)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |