Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » search » highlight » [javadoc | source]
org.apache.lucene.search.highlight
public class: GradientFormatter [javadoc | source]
java.lang.Object
   org.apache.lucene.search.highlight.GradientFormatter

All Implemented Interfaces:
    Formatter

Direct Known Subclasses:
    SpanGradientFormatter

Formats text with different color intensity depending on the score of the term.
Field Summary
 int fgRMin     
 int fgGMin     
 int fgBMin     
 int fgRMax     
 int fgGMax     
 int fgBMax     
protected  boolean highlightForeground     
 int bgRMin     
 int bgGMin     
 int bgBMin     
 int bgRMax     
 int bgGMax     
 int bgBMax     
protected  boolean highlightBackground     
Constructor:
 public GradientFormatter(float maxScore,
    String minForegroundColor,
    String maxForegroundColor,
    String minBackgroundColor,
    String maxBackgroundColor) 
    Sets the color range for the IDF scores
    Parameters:
    maxScore - The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight which can be used to calibrate scoring scale)
    minForegroundColor - The hex color used for representing IDF scores of zero eg #FFFFFF (white) or null if no foreground color required
    maxForegroundColor - The largest hex color used for representing IDF scores eg #000000 (black) or null if no foreground color required
    minBackgroundColor - The hex color used for representing IDF scores of zero eg #FFFFFF (white) or null if no background color required
    maxBackgroundColor - The largest hex color used for representing IDF scores eg #000000 (black) or null if no background color required
Method from org.apache.lucene.search.highlight.GradientFormatter Summary:
getBackgroundColorString,   getForegroundColorString,   hexToInt,   highlightTerm
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.highlight.GradientFormatter Detail:
 protected String getBackgroundColorString(float score) 
 protected String getForegroundColorString(float score) 
 public static final int hexToInt(String hex) 
    Converts a hex string into an int. Integer.parseInt(hex, 16) assumes the input is nonnegative unless there is a preceding minus sign. This method reads the input as twos complement instead, so if the input is 8 bytes long, it will correctly restore a negative int produced by Integer.toHexString() but not necessarily one produced by Integer.toString(x,16) since that method will produce a string like '-FF' for negative integer values.
 public String highlightTerm(String originalText,
    TokenGroup tokenGroup)