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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexplain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) getValues(LeafReaderContext readerContext, DoubleValues scores) inthashCode()booleanbooleanrewrite(IndexSearcher searcher) protected abstract doublescore(org.locationtech.spatial4j.shape.Rectangle rect, AtomicReference<Explanation> exp) Return a relevancy score.protected abstract StringA 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, similarityToQueryVector, similarityToQueryVector, toLongValuesSource, toSortableLongDoubleValuesSource
-
Constructor Details
-
BBoxSimilarityValueSource
-
-
Method Details
-
rewrite
- Specified by:
rewritein classDoubleValuesSource- Throws:
IOException
-
toString
- Specified by:
toStringin 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:
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
- 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
-
needsScores
public boolean needsScores()- Specified by:
needsScoresin classDoubleValuesSource
-