Package org.apache.lucene.search
Class LongValuesSource
java.lang.Object
org.apache.lucene.search.LongValuesSource
- All Implemented Interfaces:
SegmentCacheable
- Direct Known Subclasses:
DoubleValuesSource.LongDoubleValuesSource,IndexReaderFunctions.NoCacheConstantLongValuesSource,IndexReaderFunctions.SumTotalTermFreqValuesSource,LongValuesSource.ConstantLongValuesSource,LongValuesSource.FieldValuesSource,ValueSource.WrappedLongValuesSource
Base class for producing
LongValues
To obtain a LongValues object for a leaf reader, clients should
call rewrite(IndexSearcher) against the top-level searcher, and
then getValues(LeafReaderContext, DoubleValues).
LongValuesSource objects for long and int-valued NumericDocValues fields can
be obtained by calling fromLongField(String) and fromIntField(String).
To obtain a LongValuesSource from a float or double-valued NumericDocValues field,
use DoubleValuesSource.fromFloatField(String) or DoubleValuesSource.fromDoubleField(String)
and then call DoubleValuesSource.toLongValuesSource().-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static classprivate static classprivate static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static NumericDocValuesstatic LongValuesSourceconstant(long value) Creates a LongValuesSource that always returns a constant valueabstract booleanstatic LongValuesSourcefromIntField(String field) Creates a LongValuesSource that wraps an int-valued fieldstatic LongValuesSourcefromLongField(String field) Creates a LongValuesSource that wraps a long-valued fieldgetSortField(boolean reverse) Create a sort field based on the value of this producerabstract LongValuesgetValues(LeafReaderContext ctx, DoubleValues scores) Returns aLongValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.abstract inthashCode()abstract booleanReturn true if document scores are needed to calculate valuesabstract LongValuesSourcerewrite(IndexSearcher searcher) Return a LongValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.Convert to a DoubleValuesSource by casting long values to doublesprivate static LongValuesabstract StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.search.SegmentCacheable
isCacheable
-
Constructor Details
-
LongValuesSource
public LongValuesSource()
-
-
Method Details
-
getValues
Returns aLongValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.- Throws:
IOException
-
needsScores
public abstract boolean needsScores()Return true if document scores are needed to calculate values -
hashCode
public abstract int hashCode() -
equals
-
toString
-
rewrite
Return a LongValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once. IndexSearcher-independent implementations can just returnthis- Throws:
IOException
-
getSortField
Create a sort field based on the value of this producer- Parameters:
reverse- true if the sort should be decreasing
-
toDoubleValuesSource
Convert to a DoubleValuesSource by casting long values to doubles -
fromLongField
Creates a LongValuesSource that wraps a long-valued field -
fromIntField
Creates a LongValuesSource that wraps an int-valued field -
constant
Creates a LongValuesSource that always returns a constant value -
toLongValues
-
asNumericDocValues
-