Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » search » highlight » [javadoc | source]
org.apache.lucene.search.highlight
public class: Highlighter [javadoc | source]
java.lang.Object
   org.apache.lucene.search.highlight.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
public static final  int DEFAULT_MAX_CHARS_TO_ANALYZE     
Constructor:
 public Highlighter(Scorer fragmentScorer) 
 public Highlighter(Formatter formatter,
    Scorer fragmentScorer) 
 public Highlighter(Formatter formatter,
    Encoder encoder,
    Scorer fragmentScorer) 
Method from org.apache.lucene.search.highlight.Highlighter Summary:
getBestFragment,   getBestFragment,   getBestFragments,   getBestFragments,   getBestFragments,   getBestTextFragments,   getEncoder,   getFragmentScorer,   getMaxDocCharsToAnalyze,   getTextFragmenter,   setEncoder,   setFragmentScorer,   setMaxDocCharsToAnalyze,   setTextFragmenter
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.highlight.Highlighter Detail:
 public final String getBestFragment(TokenStream tokenStream,
    String text) throws IOException, InvalidTokenOffsetsException 
    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 final String getBestFragment(Analyzer analyzer,
    String fieldName,
    String text) throws IOException, InvalidTokenOffsetsException 
 public final String[] getBestFragments(TokenStream tokenStream,
    String text,
    int maxNumFragments) throws IOException, InvalidTokenOffsetsException 
    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)
 public final String[] getBestFragments(Analyzer analyzer,
    String fieldName,
    String text,
    int maxNumFragments) throws IOException, InvalidTokenOffsetsException 
 public final String getBestFragments(TokenStream tokenStream,
    String text,
    int maxNumFragments,
    String separator) throws IOException, InvalidTokenOffsetsException 
    Highlights terms in the text , extracting the most relevant sections and concatenating the chosen fragments with a separator (typically "..."). 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 in order as "separator" delimited strings.
 public final TextFragment[] getBestTextFragments(TokenStream tokenStream,
    String text,
    boolean mergeContiguousFragments,
    int maxNumFragments) throws IOException, InvalidTokenOffsetsException 
    Low level api to get the most relevant (formatted) sections of the document. This method has been made public to allow visibility of score information held in TextFragment objects. Thanks to Jason Calabrese for help in redefining the interface.
 public Encoder getEncoder() 
 public Scorer getFragmentScorer() 
 public int getMaxDocCharsToAnalyze() 
 public Fragmenter getTextFragmenter() 
 public  void setEncoder(Encoder encoder) 
 public  void setFragmentScorer(Scorer scorer) 
 public  void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze) 
 public  void setTextFragmenter(Fragmenter fragmenter)