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
A base class for calculating a spatial relevance rank per document from a provided
ShapeValuesSource
returning a Rectangle
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
explain
(LeafReaderContext ctx, int docId, Explanation scoreExplanation) getValues
(LeafReaderContext readerContext, DoubleValues scores) int
hashCode()
boolean
boolean
rewrite
(IndexSearcher searcher) protected abstract double
score
(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp) Return a relevancy score.protected abstract String
A comma-separated list of configurable items of the subclass to put intotoString()
.toString()
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
Constructor Details
-
BBoxSimilarityValueSource
-
-
Method Details
-
rewrite
- Specified by:
rewrite
in classDoubleValuesSource
- Throws:
IOException
-
toString
- Specified by:
toString
in classDoubleValuesSource
-
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
- 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
-
needsScores
public boolean needsScores()- Specified by:
needsScores
in classDoubleValuesSource
-