org.apache.lucene.search.highlight
public class GradientFormatter extends Object implements Formatter
Field Summary | |
---|---|
protected boolean | highlightBackground |
protected boolean | highlightForeground |
Constructor Summary | |
---|---|
GradientFormatter(float maxScore, String minForegroundColor, String maxForegroundColor, String minBackgroundColor, String maxBackgroundColor)
Sets the color range for the IDF scores
|
Method Summary | |
---|---|
protected String | getBackgroundColorString(float score) |
protected String | getForegroundColorString(float score) |
static int | hexToInt(String hex)
Converts a hex string into an int. |
String | highlightTerm(String originalText, TokenGroup tokenGroup) |
Parameters: maxScore The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight which can be used to callibrate 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
Parameters: hex A string in capital or lower case hex, of no more then 16 characters.
Throws: NumberFormatException if the string is more than 16 characters long, or if any character is not in the set [0-9a-fA-f]