Class GradientFormatter
Formats text with different color intensity depending on the score of the term.
Implements
Inherited Members
Namespace: Lucene.Net.Search.Highlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public class GradientFormatter : IFormatter
Constructors
GradientFormatter(float, string, string, string, string)
Sets the color range for the IDF scores
Declaration
public GradientFormatter(float maxScore, string minForegroundColor, string maxForegroundColor, string minBackgroundColor, string maxBackgroundColor)
Parameters
Type | Name | Description |
---|---|---|
float | maxScore | The score (and above) displayed as maxColor (See MaxTermWeight which can be used to callibrate scoring scale) |
string | minForegroundColor | The hex color used for representing IDF scores of zero eg #FFFFFF (white) or null if no foreground color required |
string | maxForegroundColor | The largest hex color used for representing IDF scores eg #000000 (black) or null if no foreground color required |
string | minBackgroundColor | The hex color used for representing IDF scores of zero eg #FFFFFF (white) or null if no background color required |
string | maxBackgroundColor | The largest hex color used for representing IDF scores eg #000000 (black) or null if no background color required |
Fields
m_bgBMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgBMax
Field Value
Type | Description |
---|---|
int |
m_bgBMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgBMin
Field Value
Type | Description |
---|---|
int |
m_bgGMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgGMax
Field Value
Type | Description |
---|---|
int |
m_bgGMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgGMin
Field Value
Type | Description |
---|---|
int |
m_bgRMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgRMax
Field Value
Type | Description |
---|---|
int |
m_bgRMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_bgRMin
Field Value
Type | Description |
---|---|
int |
m_fgBMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgBMax
Field Value
Type | Description |
---|---|
int |
m_fgBMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgBMin
Field Value
Type | Description |
---|---|
int |
m_fgGMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgGMax
Field Value
Type | Description |
---|---|
int |
m_fgGMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgGMin
Field Value
Type | Description |
---|---|
int |
m_fgRMax
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgRMax
Field Value
Type | Description |
---|---|
int |
m_fgRMin
Formats text with different color intensity depending on the score of the term.
Declaration
protected int m_fgRMin
Field Value
Type | Description |
---|---|
int |
m_highlightBackground
Formats text with different color intensity depending on the score of the term.
Declaration
protected bool m_highlightBackground
Field Value
Type | Description |
---|---|
bool |
m_highlightForeground
Formats text with different color intensity depending on the score of the term.
Declaration
protected bool m_highlightForeground
Field Value
Type | Description |
---|---|
bool |
Methods
GetBackgroundColorString(float)
Formats text with different color intensity depending on the score of the term.
Declaration
protected virtual string GetBackgroundColorString(float score)
Parameters
Type | Name | Description |
---|---|---|
float | score |
Returns
Type | Description |
---|---|
string |
GetForegroundColorString(float)
Formats text with different color intensity depending on the score of the term.
Declaration
protected virtual string GetForegroundColorString(float score)
Parameters
Type | Name | Description |
---|---|---|
float | score |
Returns
Type | Description |
---|---|
string |
HexToInt32(string)
Converts a hex string into an int.
NOTE: This was hexToInt() in LuceneDeclaration
public static int HexToInt32(string hex)
Parameters
Type | Name | Description |
---|---|---|
string | hex | A string in capital or lower case hex, of no more then 16 characters. |
Returns
Type | Description |
---|---|
int |
Exceptions
Type | Condition |
---|---|
FormatException | if the string is more than 16 characters long, or if any character is not in the set [0-9a-fA-f] |
HexToInt32(string, int, int)
Converts a hex string at the specified index and length of hex
into an int.
Declaration
public static int HexToInt32(string hex, int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
string | hex | A string in capital or lower case hex, of no more then 16 characters. |
int | startIndex | The index of the first character to begin parsing. |
int | length | The number of characters to parse. |
Returns
Type | Description |
---|---|
int |
Exceptions
Type | Condition |
---|---|
FormatException | if the string is more than 16 characters long, or if any character is not in the set [0-9a-fA-f] |
ArgumentOutOfRangeException |
startIndex and length refer to a location outside of hex .
|
HighlightTerm(string, TokenGroup)
Formats text with different color intensity depending on the score of the term.
Declaration
public virtual string HighlightTerm(string originalText, TokenGroup tokenGroup)
Parameters
Type | Name | Description |
---|---|---|
string | originalText | The section of text being considered for markup |
TokenGroup | tokenGroup | contains one or several overlapping Tokens along with their scores and positions. |
Returns
Type | Description |
---|---|
string |