Class 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
Inherited Members
Namespace: Lucene.Net.Queries.Function.ValueSources
Assembly: Lucene.Net.Queries.dll
Syntax
public class ReciprocalSingleFunction : ValueSource
Constructors
ReciprocalSingleFunction(ValueSource, float, float, float)
f(source) = a/(m*float(source)+b)
Declaration
public ReciprocalSingleFunction(ValueSource source, float m, float a, float b)
Parameters
Type | Name | Description |
---|---|---|
ValueSource | source | |
float | m | |
float | a | |
float | b |
See Also
Fields
m_a
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
Declaration
protected readonly float m_a
Field Value
Type | Description |
---|---|
float |
See Also
m_b
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
Declaration
protected readonly float m_b
Field Value
Type | Description |
---|---|
float |
See Also
m_m
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
Declaration
protected readonly float m_m
Field Value
Type | Description |
---|---|
float |
See Also
m_source
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
Declaration
protected readonly ValueSource m_source
Field Value
Type | Description |
---|---|
ValueSource |
See Also
Methods
CreateWeight(IDictionary, IndexSearcher)
Implementations should propagate CreateWeight to sub-ValueSources which can optionally store weight info in the context. The context object will be passed to GetValues() where this info can be retrieved.
Declaration
public override void CreateWeight(IDictionary context, IndexSearcher searcher)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | context | |
IndexSearcher | searcher |
Overrides
See Also
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
See Also
GetDescription()
description of field, used in Explain()
Declaration
public override string GetDescription()
Returns
Type | Description |
---|---|
string |
Overrides
See Also
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
See Also
GetValues(IDictionary, AtomicReaderContext)
Gets the values for this reader and the context that was previously passed to CreateWeight(IDictionary, IndexSearcher)
Declaration
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | context | |
AtomicReaderContext | readerContext |
Returns
Type | Description |
---|---|
FunctionValues |