Package org.apache.lucene.spatial.bbox
Class BBoxSimilarityValueSource
- java.lang.Object
-
- org.apache.lucene.search.DoubleValuesSource
-
- org.apache.lucene.spatial.bbox.BBoxSimilarityValueSource
-
- All Implemented Interfaces:
SegmentCacheable
- Direct Known Subclasses:
BBoxOverlapRatioValueSource
public abstract class BBoxSimilarityValueSource extends DoubleValuesSource
A base class for calculating a spatial relevance rank per document from a providedShapeValuesSourcereturning aRectangleper-document.Implementers: remember to implement equals and hashCode if you have fields!
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
-
Constructor Summary
Constructors Constructor Description BBoxSimilarityValueSource(ShapeValuesSource bboxValueSource)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Explanationexplain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)DoubleValuesgetValues(LeafReaderContext readerContext, DoubleValues scores)inthashCode()booleanisCacheable(LeafReaderContext ctx)booleanneedsScores()DoubleValuesSourcerewrite(IndexSearcher searcher)protected abstract doublescore(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp)Return a relevancy score.protected abstract StringsimilarityDescription()A comma-separated list of configurable items of the subclass to put intotoString().StringtoString()-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, similarityToQueryVector, similarityToQueryVector, toLongValuesSource, toSortableLongDoubleValuesSource
-
-
-
-
Constructor Detail
-
BBoxSimilarityValueSource
public BBoxSimilarityValueSource(ShapeValuesSource bboxValueSource)
-
-
Method Detail
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException
- Specified by:
rewritein classDoubleValuesSource- Throws:
IOException
-
toString
public String toString()
- Specified by:
toStringin classDoubleValuesSource
-
similarityDescription
protected abstract String similarityDescription()
A comma-separated list of configurable items of the subclass to put intotoString().
-
getValues
public DoubleValues getValues(LeafReaderContext readerContext, DoubleValues scores) throws IOException
- Specified by:
getValuesin classDoubleValuesSource- Throws:
IOException
-
score
protected abstract double score(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp)Return a relevancy score. Ifexpis provided then diagnostic information is added.- Parameters:
rect- The indexed rectangle; not null.exp- Optional diagnostic holder.- Returns:
- a score.
-
equals
public boolean equals(Object o)
- Specified by:
equalsin classDoubleValuesSource
-
hashCode
public int hashCode()
- Specified by:
hashCodein classDoubleValuesSource
-
explain
public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException
- Overrides:
explainin classDoubleValuesSource- Throws:
IOException
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
-
needsScores
public boolean needsScores()
- Specified by:
needsScoresin classDoubleValuesSource
-
-