C# Class Lucene.Net.Search.Highlight.GradientFormatter

Copyright 2002-2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Formats text with different color intensity depending on the score of the term.
Inheritance: Formatter
Mostrar archivo Open project: synhershko/lucene.net

Protected Properties

Property Type Description
bgRMax int
bgRMin int
fgRMax int
fgRMin int
highlightBackground bool
highlightForeground bool

Public Methods

Method Description
GradientFormatter ( float maxScore, string minForegroundColor, string maxForegroundColor, string minBackgroundColor, string maxBackgroundColor ) : System

Sets the color range for the IDF scores

HexToInt ( string hex ) : int

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 neccesarily one produced by Integer.toString(x,16) since that method will produce a string like '-FF' for negative integer values.

HighlightTerm ( string originalText, Lucene.Net.Search.Highlight.TokenGroup tokenGroup ) : string

Protected Methods

Method Description
GetBackgroundColorString ( float score ) : string
GetForegroundColorString ( float score ) : string

Private Methods

Method Description
GetColorVal ( int colorMin, int colorMax, float score ) : int
IntToHex ( int i ) : string

Method Details

GetBackgroundColorString() protected method

protected GetBackgroundColorString ( float score ) : string
score float
return string

GetForegroundColorString() protected method

protected GetForegroundColorString ( float score ) : string
score float
return string

GradientFormatter() public method

Sets the color range for the IDF scores
public GradientFormatter ( float maxScore, string minForegroundColor, string maxForegroundColor, string minBackgroundColor, string maxBackgroundColor ) : System
maxScore float /// The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight /// which can be used to callibrate scoring scale) ///
minForegroundColor string /// The hex color used for representing IDF scores of zero eg /// #FFFFFF (white) or null if no foreground color required ///
maxForegroundColor string /// The largest hex color used for representing IDF scores eg /// #000000 (black) or null if no foreground color required ///
minBackgroundColor string /// The hex color used for representing IDF scores of zero eg /// #FFFFFF (white) or null if no background color required ///
maxBackgroundColor string /// The largest hex color used for representing IDF scores eg /// #000000 (black) or null if no background color required ///
return System

HexToInt() public static method

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 neccesarily one produced by Integer.toString(x,16) since that method will produce a string like '-FF' for negative integer values.
if the string is more than 16 characters long, or if any /// character is not in the set [0-9a-fA-f]
public static HexToInt ( string hex ) : int
hex string /// A string in capital or lower case hex, of no more then 16 /// characters. ///
return int

HighlightTerm() public method

public HighlightTerm ( string originalText, Lucene.Net.Search.Highlight.TokenGroup tokenGroup ) : string
originalText string
tokenGroup Lucene.Net.Search.Highlight.TokenGroup
return string

Property Details

bgRMax protected_oe property

protected int bgRMax
return int

bgRMin protected_oe property

protected int bgRMin
return int

fgRMax protected_oe property

protected int fgRMax
return int

fgRMin protected_oe property

protected int fgRMin
return int

highlightBackground protected_oe property

protected bool highlightBackground
return bool

highlightForeground protected_oe property

protected bool highlightForeground
return bool