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
public abstract class LongValuesSource extends java.lang.Object implements SegmentCacheable
Base class for producingLongValues
To obtain aLongValues
object for a leaf reader, clients should callrewrite(IndexSearcher)
against the top-level searcher, and thengetValues(LeafReaderContext, DoubleValues)
. LongValuesSource objects for long and int-valued NumericDocValues fields can be obtained by callingfromLongField(String)
andfromIntField(String)
. To obtain a LongValuesSource from a float or double-valued NumericDocValues field, useDoubleValuesSource.fromFloatField(String)
orDoubleValuesSource.fromDoubleField(String)
and then callDoubleValuesSource.toLongValuesSource()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LongValuesSource.ConstantLongValuesSource
private static class
LongValuesSource.DoubleLongValuesSource
private static class
LongValuesSource.FieldValuesSource
private static class
LongValuesSource.LongValuesComparatorSource
private static class
LongValuesSource.LongValuesHolder
private static class
LongValuesSource.LongValuesSortField
-
Constructor Summary
Constructors Constructor Description LongValuesSource()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static NumericDocValues
asNumericDocValues(LongValuesSource.LongValuesHolder in)
static LongValuesSource
constant(long value)
Creates a LongValuesSource that always returns a constant valueabstract boolean
equals(java.lang.Object obj)
static LongValuesSource
fromIntField(java.lang.String field)
Creates a LongValuesSource that wraps an int-valued fieldstatic LongValuesSource
fromLongField(java.lang.String field)
Creates a LongValuesSource that wraps a long-valued fieldSortField
getSortField(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 scores If scores are not needed to calculate the values (iereturns false
, callers may safely passnull
for thescores
parameter.abstract int
hashCode()
abstract boolean
needsScores()
Return true if document scores are needed to calculate valuesabstract LongValuesSource
rewrite(IndexSearcher searcher)
Return a LongValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.DoubleValuesSource
toDoubleValuesSource()
Convert to a DoubleValuesSource by casting long values to doublesprivate static LongValues
toLongValues(NumericDocValues in)
abstract java.lang.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
-
-
-
-
Method Detail
-
getValues
public abstract LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws java.io.IOException
Returns aLongValues
instance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false
, callers may safely passnull
for thescores
parameter.- Throws:
java.io.IOException
-
needsScores
public abstract boolean needsScores()
Return true if document scores are needed to calculate values
-
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
rewrite
public abstract LongValuesSource rewrite(IndexSearcher searcher) throws java.io.IOException
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:
java.io.IOException
-
getSortField
public SortField getSortField(boolean reverse)
Create a sort field based on the value of this producer- Parameters:
reverse
- true if the sort should be decreasing
-
toDoubleValuesSource
public DoubleValuesSource toDoubleValuesSource()
Convert to a DoubleValuesSource by casting long values to doubles
-
fromLongField
public static LongValuesSource fromLongField(java.lang.String field)
Creates a LongValuesSource that wraps a long-valued field
-
fromIntField
public static LongValuesSource fromIntField(java.lang.String field)
Creates a LongValuesSource that wraps an int-valued field
-
constant
public static LongValuesSource constant(long value)
Creates a LongValuesSource that always returns a constant value
-
toLongValues
private static LongValues toLongValues(NumericDocValues in)
-
asNumericDocValues
private static NumericDocValues asNumericDocValues(LongValuesSource.LongValuesHolder in)
-
-