Namespace Lucene.Net.Queries.Function.ValueSources
A variety of functions to use with FunctionQuery.
Classes
BoolFunction
Abstract parent class for those Value
ByteFieldSource
Obtains
BytesRefFieldSource
An implementation for retrieving Function
ConstNumberSource
Const
ConstValueSource
Const
DefFunction
Value
DivSingleFunction
Function to divide "a" by "b"
NOTE: This was DivFloatFunction in Lucene
DocFreqValueSource
Doc
DoubleConstValueSource
Function that returns a constant double value for every document.
DoubleFieldSource
Obtains
DualSingleFunction
Abstract Value
NOTE: This was DualFloatFunction in Lucene
EnumFieldSource
Obtains
FieldCacheSource
A base class for Value
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
Linear
Normally Used as an argument to a Function
NOTE: This was LinearFloatFunction in Lucene
LiteralValueSource
Pass a the field value through as a
MaxDocValueSource
Returns the value of Max
MaxSingleFunction
Max
NOTE: This was MaxFloatFunction in Lucene
MinSingleFunction
Min
NOTE: This was MinFloatFunction in Lucene
MultiBoolFunction
Abstract Value
MultiFunction
Abstract parent class for Value
MultiFunction.Values
MultiSingleFunction
Abstract Value
NOTE: This was MultiFloatFunction in Lucene
MultiValueSource
A Value
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 Num
OrdFieldSource
Obtains the ordinal of the field value from the default Lucene Field
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
Product
NOTE: This was ProductFloatFunction in Lucene
QueryValueSource
Query
RangeMapSingleFunction
Rangemin
and max
inclusive to target
.
Normally used as an argument to a Function
NOTE: This was RangeMapFloatFunction in Lucene
ReciprocalSingleFunction
Reciprocalf(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 Field
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
Bool
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
Sum
NOTE: This was SumFloatFunction in Lucene
SumTotalTermFreqValueSource
Sum
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
Total
VectorValueSource
Converts individual Value