Package org.apache.lucene.document
Class LongDistanceFeatureQuery.DistanceScorer
- java.lang.Object
-
- org.apache.lucene.search.Scorable
-
- org.apache.lucene.search.Scorer
-
- org.apache.lucene.document.LongDistanceFeatureQuery.DistanceScorer
-
- Enclosing class:
- LongDistanceFeatureQuery
private class LongDistanceFeatureQuery.DistanceScorer extends Scorer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.Scorable
Scorable.ChildScorable
-
-
Field Summary
Fields Modifier and Type Field Description private float
boost
private int
doc
private NumericDocValues
docValues
private DocIdSetIterator
it
private long
leadCost
private long
maxDistance
private int
maxDoc
private PointValues
pointValues
private int
setMinCompetitiveScoreCounter
-
Constructor Summary
Constructors Modifier Constructor Description protected
DistanceScorer(Weight weight, int maxDoc, long leadCost, float boost, PointValues pointValues, NumericDocValues docValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private long
computeMaxDistance(float minScore, long previousMaxDistance)
Inverting the score computation is very hard due to all potential rounding errors, so we binary search the maximum distance.int
docID()
Returns the doc ID that is currently being scored.float
getMaxScore(int upTo)
Return the maximum score that documents between the lasttarget
that this iterator wasshallow-advanced
to included andupTo
included.DocIdSetIterator
iterator()
Return aDocIdSetIterator
over matching documents.float
score()
Returns the score of the current document matching the query.private float
score(double distance)
void
setMinCompetitiveScore(float minScore)
Optional method: Tell the scorer that its iterator may safely ignore all documents whose score is less than the givenminScore
.-
Methods inherited from class org.apache.lucene.search.Scorer
advanceShallow, getWeight, twoPhaseIterator
-
Methods inherited from class org.apache.lucene.search.Scorable
getChildren
-
-
-
-
Field Detail
-
maxDoc
private final int maxDoc
-
it
private DocIdSetIterator it
-
doc
private int doc
-
leadCost
private final long leadCost
-
boost
private final float boost
-
pointValues
private final PointValues pointValues
-
docValues
private final NumericDocValues docValues
-
maxDistance
private long maxDistance
-
setMinCompetitiveScoreCounter
private int setMinCompetitiveScoreCounter
-
-
Constructor Detail
-
DistanceScorer
protected DistanceScorer(Weight weight, int maxDoc, long leadCost, float boost, PointValues pointValues, NumericDocValues docValues)
-
-
Method Detail
-
docID
public int docID()
Description copied from class:Scorable
Returns the doc ID that is currently being scored.
-
score
private float score(double distance)
-
computeMaxDistance
private long computeMaxDistance(float minScore, long previousMaxDistance)
Inverting the score computation is very hard due to all potential rounding errors, so we binary search the maximum distance.
-
score
public float score() throws java.io.IOException
Description copied from class:Scorable
Returns the score of the current document matching the query.
-
iterator
public DocIdSetIterator iterator()
Description copied from class:Scorer
Return aDocIdSetIterator
over matching documents. The returned iterator will either be positioned on-1
if no documents have been scored yet,DocIdSetIterator.NO_MORE_DOCS
if all documents have been scored already, or the last document id that has been scored otherwise. The returned iterator is a view: calling this method several times will return iterators that have the same state.
-
getMaxScore
public float getMaxScore(int upTo)
Description copied from class:Scorer
Return the maximum score that documents between the lasttarget
that this iterator wasshallow-advanced
to included andupTo
included.- Specified by:
getMaxScore
in classScorer
-
setMinCompetitiveScore
public void setMinCompetitiveScore(float minScore) throws java.io.IOException
Description copied from class:Scorable
Optional method: Tell the scorer that its iterator may safely ignore all documents whose score is less than the givenminScore
. This is a no-op by default. This method may only be called from collectors that useScoreMode.TOP_SCORES
, and successive calls may only set increasing values ofminScore
.- Overrides:
setMinCompetitiveScore
in classScorable
- Throws:
java.io.IOException
-
-