Class LongValuesSource
- All Implemented Interfaces:
SegmentCacheable
- Direct Known Subclasses:
LongValuesSource.ConstantLongValuesSource
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
Modifier and TypeClassDescriptionstatic class
A ConstantLongValuesSource that always returns a constant value -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LongValuesSource
constant
(long value) Creates a LongValuesSource that always returns a constant valueabstract boolean
static LongValuesSource
fromIntField
(String field) Creates a LongValuesSource that wraps an int-valued fieldstatic LongValuesSource
fromLongField
(String field) Creates a LongValuesSource that wraps a long-valued fieldgetSortField
(boolean reverse) Create a sort field based on the value of this producerabstract LongValues
getValues
(LeafReaderContext ctx, DoubleValues scores) Returns aLongValues
instance for the passed-in LeafReaderContext and scoresabstract int
hashCode()
abstract boolean
Return true if document scores are needed to calculate valuesabstract LongValuesSource
rewrite
(IndexSearcher searcher) Return a LongValuesSource specialised for the given IndexSearcherConvert to a DoubleValuesSource by casting long values to doublesabstract String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.lucene.search.SegmentCacheable
isCacheable
-
Constructor Details
-
LongValuesSource
public LongValuesSource()
-
-
Method Details
-
getValues
Returns aLongValues
instance for the passed-in LeafReaderContext and scoresIf scores are not needed to calculate the values (ie
returns false
, callers may safely passnull
for thescores
parameter.- 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 IndexSearcherImplementations should assume that this will only be called once. IndexSearcher-independent implementations can just return
this
- 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
-