Namespace Lucene.Net.Queries.Function.ValueSources
A variety of functions to use with FunctionQuery.
Classes
BoolFunction
Abstract parent class for those ValueSource implementations which apply boolean logic to their values
ByteFieldSource
Obtains
BytesRefFieldSource
An implementation for retrieving FunctionValues instances for
ConstNumberSource
ConstNumberSource is the base class for all constant numbers
ConstValueSource
ConstValueSource returns a constant for all documents
DefFunction
ValueSource implementation which only returns the values from the provided ValueSources which are available for a particular docId. Consequently, when combined with a ConstValueSource, this function serves as a way to return a default value when the values for a field are unavailable.
DivSingleFunction
Function to divide "a" by "b"
NOTE: This was DivFloatFunction in Lucene
DocFreqValueSource
DocFreqValueSource returns the number of documents containing the term.
DoubleConstValueSource
Function that returns a constant double value for every document.
DoubleFieldSource
Obtains
DualSingleFunction
Abstract ValueSource implementation which wraps two ValueSources
and applies an extendible
NOTE: This was DualFloatFunction in Lucene
EnumFieldSource
Obtains
FieldCacheSource
A base class for ValueSource implementations that retrieve values for a single field from the FieldCache.
IDFValueSource
Function that returns
Note that the configured Similarity for the field must be a subclass of TFIDFSimilarity @lucene.internal
IfFunction
Depending on the
Int16FieldSource
Obtains
NOTE: This was ShortFieldSource in Lucene
Int32FieldSource
Obtains
NOTE: This was IntFieldSource in Lucene
Int64FieldSource
Obtains
NOTE: This was LongFieldSource in Lucene
JoinDocFreqValueSource
Use a field value and find the Document Frequency within another field.
@since solr 4.0
LinearSingleFunction
LinearSingleFunction implements a linear function over another ValueSource.
Normally Used as an argument to a FunctionQuery
NOTE: This was LinearFloatFunction in Lucene
LiteralValueSource
Pass a the field value through as a
MaxDocValueSource
Returns the value of MaxDoc for every document. This is the number of documents including deletions.
MaxSingleFunction
MaxSingleFunction returns the max of it's components.
NOTE: This was MaxFloatFunction in Lucene
MinSingleFunction
MinSingleFunction returns the min of it's components.
NOTE: This was MinFloatFunction in Lucene
MultiBoolFunction
Abstract ValueSource implementation which wraps multiple ValueSources
and applies an extendible
MultiFunction
Abstract parent class for ValueSource implementations that wrap multiple ValueSources and apply their own logic.
MultiFunction.Values
MultiSingleFunction
Abstract ValueSource implementation which wraps multiple ValueSources
and applies an extendible
NOTE: This was MultiFloatFunction in Lucene
MultiValueSource
A ValueSource that abstractly represents ValueSources for poly fields, and other things.
NormValueSource
Function that returns
Note that the configured Similarity for the field must be a subclass of TFIDFSimilarity @lucene.internal
NumDocsValueSource
Returns the value of NumDocs for every document. This is the number of documents excluding deletions.
OrdFieldSource
Obtains the ordinal of the field value from the default Lucene FieldCache using StringIndex.
The native lucene index order is used to assign an ordinal value for each field value.
Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
Example:
If there were only three field values: "apple","banana","pear"
then ord("apple")=1, ord("banana")=2, ord("pear")=3
WARNING: Ord depends on the position in an index and can thus change when other documents are inserted or deleted, or if a MultiSearcher is used.
WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry at the top level reader, while sorting and function queries now use entries at the segment level. Hence sorting or using a different function query, in addition to ord()/rord() will double memory use.
PowSingleFunction
Function to raise the base "a" to the power "b"
NOTE: This was PowFloatFunction in Lucene
ProductSingleFunction
ProductSingleFunction returns the product of it's components.
NOTE: This was ProductFloatFunction in Lucene
QueryValueSource
QueryValueSource returns the relevance score of the query
RangeMapSingleFunction
RangeMapSingleFunction implements a map function over
another ValueSource whose values fall within min
and max
inclusive to target
.
Normally used as an argument to a FunctionQuery
NOTE: This was RangeMapFloatFunction in Lucene
ReciprocalSingleFunction
ReciprocalSingleFunction implements a reciprocal function f(x) = a/(mx+b)
, based on
the
When a and b are equal, and x>=0
, this function has a maximum value of 1 that drops as x increases.
Increasing the value of a and b together results in a movement of the entire function to a flatter part of the curve.
These properties make this an idea function for boosting more recent documents.
Example: recip(ms(NOW,mydatefield),3.16e-11,1,1)
A multiplier of 3.16e-11 changes the units from milliseconds to years (since there are about 3.16e10 milliseconds per year). Thus, a very recent date will yield a value close to 1/(0+1) or 1, a date a year in the past will get a multiplier of about 1/(1+1) or 1/2, and date two years old will yield 1/(2+1) or 1/3.
NOTE: This was ReciprocalFloatFunction in Lucene
ReverseOrdFieldSource
Obtains the ordinal of the field value from the default Lucene FieldCache using
The native lucene index order is used to assign an ordinal value for each field value.
Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
Example of reverse ordinal (rord):
If there were only three field values: "apple","banana","pear"
then rord("apple")=3, rord("banana")=2, ord("pear")=1
WARNING: Ord depends on the position in an index and can thus change when other documents are inserted or deleted, or if a MultiSearcher is used.
WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry at the top level reader, while sorting and function queries now use entries at the segment level. Hence sorting or using a different function query, in addition to ord()/rord() will double memory use.
ScaleSingleFunction
Scales values to be between min
and max
.
This implementation currently traverses all of the source values to obtain their min and max.
This implementation currently cannot distinguish when documents have been deleted or documents that have no value, and 0.0 values will be used for these cases. This means that if values are normally all greater than 0.0, one can still end up with 0.0 as the min value to map from. In these cases, an appropriate map() function could be used as a workaround to change 0.0 to a value in the real range.
NOTE: This was ScaleFloatFunction in Lucene
SimpleBoolFunction
BoolFunction implementation which applies an extendible
Functions this can be used for include whether a field has a value or not,
or inverting the
SimpleSingleFunction
A simple
NOTE: This was SimpleFloatFunction in Lucene
SingleFieldSource
Obtains
NOTE: This was FloatFieldSource in Lucene
SingularFunction
A function with a single (one) argument.
NOTE: This was SingleFunction in Lucene, changed to avoid conusion with operations on the datatype
SumSingleFunction
SumSingleFunction returns the sum of its components.
NOTE: This was SumFloatFunction in Lucene
SumTotalTermFreqValueSource
SumTotalTermFreqValueSource returns the number of tokens. (sum of term freqs across all documents, across all terms). Returns -1 if frequencies were omitted for the field, or if the codec doesn't support this statistic.
TermFreqValueSource
Function that returns Freq for the supplied term in every document.
If the term does not exist in the document, returns 0. If frequencies are omitted, returns 1.
TFValueSource
Function that returns
Note that the configured Similarity for the field must be a subclass of TFIDFSimilarity @lucene.internal
TotalTermFreqValueSource
TotalTermFreqValueSource returns the total term freq (sum of term freqs across all documents). Returns -1 if frequencies were omitted for the field, or if the codec doesn't support this statistic.
VectorValueSource
Converts individual ValueSource instances to leverage the FunctionValues *Val functions that work with multiple values, i.e. DoubleVal(Int32, Double[])