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 providedShapeValuesSource
returning aRectangle
per-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 boolean
equals(Object o)
Explanation
explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
DoubleValues
getValues(LeafReaderContext readerContext, DoubleValues scores)
int
hashCode()
boolean
isCacheable(LeafReaderContext ctx)
boolean
needsScores()
DoubleValuesSource
rewrite(IndexSearcher searcher)
protected abstract double
score(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp)
Return a relevancy score.protected abstract String
similarityDescription()
A comma-separated list of configurable items of the subclass to put intotoString()
.String
toString()
-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, similarityToQueryVector, similarityToQueryVector, toLongValuesSource
-
-
-
-
Constructor Detail
-
BBoxSimilarityValueSource
public BBoxSimilarityValueSource(ShapeValuesSource bboxValueSource)
-
-
Method Detail
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException
- Specified by:
rewrite
in classDoubleValuesSource
- Throws:
IOException
-
toString
public String toString()
- Specified by:
toString
in 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:
getValues
in classDoubleValuesSource
- Throws:
IOException
-
score
protected abstract double score(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp)
Return a relevancy score. Ifexp
is 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:
equals
in classDoubleValuesSource
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classDoubleValuesSource
-
explain
public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException
- Overrides:
explain
in classDoubleValuesSource
- Throws:
IOException
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
-
needsScores
public boolean needsScores()
- Specified by:
needsScores
in classDoubleValuesSource
-
-