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 int field values from the Lucene.Net.Search.FieldCache using GetInt32s(AtomicReader, string, IInt32Parser, bool) and makes those values available as other numeric types, casting as needed. *
BytesRefFieldSource
An implementation for retrieving FunctionValues instances for string based fields.
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 LuceneDocFreqValueSource
DocFreqValueSource returns the number of documents containing the term.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
DoubleConstValueSource
Function that returns a constant double value for every document.
DoubleFieldSource
Obtains double field values from GetDoubles(AtomicReader, string, IDoubleParser, bool) and makes those values available as other numeric types, casting as needed.
DualSingleFunction
Abstract ValueSource implementation which wraps two ValueSources and applies an extendible float function to their values.
NOTE: This was DualFloatFunction in LuceneEnumFieldSource
Obtains int field values from GetInt32s(AtomicReader, string, IInt32Parser, bool) and makes those values available as other numeric types, casting as needed. StrVal of the value is not the int value, but its string (displayed) value.
FieldCacheSource
A base class for ValueSource implementations that retrieve values for a single field from the Lucene.Net.Search.FieldCache.
IDFValueSource
Function that returns Idf(long, long) for every document.
Note that the configured Similarity for the field must be a subclass of Lucene.Net.Search.Similarities.TFIDFSimilarityNote
This API is for internal purposes only and might change in incompatible ways in the next release.
IfFunction
Depending on the bool value of the ifSource function, returns the value of the trueSource or falseSource function.
Int16FieldSource
Obtains short field values from the Lucene.Net.Search.FieldCache using GetInt16s(AtomicReader, string, IInt16Parser, bool) and makes those values available as other numeric types, casting as needed.
NOTE: This was ShortFieldSource in LuceneInt32FieldSource
Obtains int field values from GetInt32s(AtomicReader, string, IInt32Parser, bool) and makes those values available as other numeric types, casting as needed.
NOTE: This was IntFieldSource in LuceneInt64FieldSource
Obtains long field values from GetInt64s(AtomicReader, string, IInt64Parser, bool) and makes those values available as other numeric types, casting as needed.
NOTE: This was LongFieldSource in LuceneJoinDocFreqValueSource
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 LuceneLiteralValueSource
Pass a the field value through as a string, no matter the type // Q: doesn't this mean it's a "str"?
MaxDocValueSource
Returns the value of Lucene.Net.Index.IndexReader.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 LuceneMinSingleFunction
MinSingleFunction returns the min of it's components.
NOTE: This was MinFloatFunction in LuceneMultiBoolFunction
Abstract ValueSource implementation which wraps multiple ValueSources and applies an extendible bool function to their values.
MultiFunction
Abstract parent class for ValueSource implementations that wrap multiple ValueSources and apply their own logic.
MultiFunction.Values
A variety of functions to use with FunctionQuery.
MultiSingleFunction
Abstract ValueSource implementation which wraps multiple ValueSources and applies an extendible float function to their values.
NOTE: This was MultiFloatFunction in LuceneMultiValueSource
A ValueSource that abstractly represents ValueSources for poly fields, and other things.
NormValueSource
Function that returns DecodeNormValue(long) for every document.
Note that the configured Similarity for the field must be a subclass of Lucene.Net.Search.Similarities.TFIDFSimilarityNote
This API is for internal purposes only and might change in incompatible ways in the next release.
NumDocsValueSource
Returns the value of Lucene.Net.Index.IndexReader.NumDocs for every document. This is the number of documents excluding deletions.
OrdFieldSource
Obtains the ordinal of the field value from the default Lucene Lucene.Net.Search.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 LuceneProductSingleFunction
ProductSingleFunction returns the product of it's components.
NOTE: This was ProductFloatFunction in LuceneQueryValueSource
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
.
ReciprocalSingleFunction
ReciprocalSingleFunction implements a reciprocal function f(x) = a/(mx+b)
, based on
the float value of a field or function as exported by ValueSource.
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 Lucene.Net.Search.FieldCache using GetTermsIndex(AtomicReader, string, float) and reverses the order.
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
.
SimpleBoolFunction
BoolFunction implementation which applies an extendible bool function to the values of a single wrapped ValueSource.
Functions this can be used for include whether a field has a value or not, or inverting the bool value of the wrapped ValueSource.
SimpleSingleFunction
A simple float function with a single argument
NOTE: This was SimpleFloatFunction in LuceneSingleFieldSource
Obtains float field values from GetSingles(AtomicReader, string, ISingleParser, bool) and makes those values available as other numeric types, casting as needed.
NOTE: This was FloatFieldSource in LuceneSingularFunction
A function with a single (one) argument.
NOTE: This was SingleFunction in Lucene, changed to avoid conusion with operations on the datatype float.SumSingleFunction
SumSingleFunction returns the sum of its components.
NOTE: This was SumFloatFunction in LuceneSumTotalTermFreqValueSource
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.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
TFValueSource
Function that returns Tf(float) for every document.
Note that the configured Similarity for the field must be a subclass of Lucene.Net.Search.Similarities.TFIDFSimilarityNote
This API is for internal purposes only and might change in incompatible ways in the next release.
TermFreqValueSource
Function that returns Lucene.Net.Index.DocsEnum.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.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.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
VectorValueSource
Converts individual ValueSource instances to leverage the FunctionValues *Val functions that work with multiple values, i.e. DoubleVal(int, double[])