Package org.apache.lucene.spatial.util
Class ShapeFieldCacheDistanceValueSource
- java.lang.Object
-
- org.apache.lucene.search.DoubleValuesSource
-
- org.apache.lucene.spatial.util.ShapeFieldCacheDistanceValueSource
-
- All Implemented Interfaces:
SegmentCacheable
public class ShapeFieldCacheDistanceValueSource extends DoubleValuesSource
A DoubleValuesSource that returns the spatial distance between an input point and a document's points inShapeFieldCacheProvider. The shortest distance is returned if a document has more than one point.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
-
Constructor Summary
Constructors Constructor Description ShapeFieldCacheDistanceValueSource(SpatialContext ctx, ShapeFieldCacheProvider<Point> provider, Point from, double multiplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)DoubleValuesgetValues(LeafReaderContext readerContext, DoubleValues scores)Returns aDoubleValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.inthashCode()booleanisCacheable(LeafReaderContext ctx)booleanneedsScores()Return true if document scores are needed to calculate valuesDoubleValuesSourcerewrite(IndexSearcher searcher)Return a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.StringtoString()-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
-
-
-
Constructor Detail
-
ShapeFieldCacheDistanceValueSource
public ShapeFieldCacheDistanceValueSource(SpatialContext ctx, ShapeFieldCacheProvider<Point> provider, Point from, double multiplier)
-
-
Method Detail
-
toString
public String toString()
- Specified by:
toStringin classDoubleValuesSource
-
getValues
public DoubleValues getValues(LeafReaderContext readerContext, DoubleValues scores) throws IOException
Description copied from class:DoubleValuesSourceReturns aDoubleValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.- Specified by:
getValuesin classDoubleValuesSource- Throws:
IOException
-
needsScores
public boolean needsScores()
Description copied from class:DoubleValuesSourceReturn true if document scores are needed to calculate values- Specified by:
needsScoresin classDoubleValuesSource
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
- Returns:
trueif the object can be cached against a given leaf
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException
Description copied from class:DoubleValuesSourceReturn a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once. IndexReader-independent implementations can just returnthisQueries that use DoubleValuesSource objects should call rewrite() duringQuery.createWeight(IndexSearcher, ScoreMode, float)rather than duringQuery.rewrite(IndexReader)to avoid IndexReader reference leakage. For the same reason, implementations that cache references to the IndexSearcher should return a new object from this method.- Specified by:
rewritein classDoubleValuesSource- Throws:
IOException
-
equals
public boolean equals(Object o)
- Specified by:
equalsin classDoubleValuesSource
-
hashCode
public int hashCode()
- Specified by:
hashCodein classDoubleValuesSource
-
-