public abstract class Spans extends Scorer
Scorer.ChildScorer
Modifier and Type | Field and Description |
---|---|
protected Similarity.SimScorer |
docScorer |
protected float |
freq
accumulated sloppy freq (computed in setFreqCurrentDoc)
|
static int |
NO_MORE_POSITIONS |
protected int |
numMatches
number of matches (computed in setFreqCurrentDoc)
|
NO_MORE_DOCS
Modifier | Constructor and Description |
---|---|
protected |
Spans(SpanWeight weight,
Similarity.SimScorer docScorer) |
Modifier and Type | Method and Description |
---|---|
abstract void |
collect(SpanCollector collector)
Collect postings data from the leaves of the current Spans.
|
protected void |
doCurrentSpans()
Called each time the scorer's SpanScorer is advanced during frequency calculation
|
protected void |
doStartCurrentDoc()
Called before the current doc's frequency is calculated
|
abstract int |
endPosition()
Returns the end position for the current start position, or -1 when
nextStartPosition() was not yet called on the current doc. |
int |
freq()
Returns the freq of this Scorer on the current document
|
abstract int |
nextStartPosition()
Returns the next start position for the current doc.
|
abstract float |
positionsCost()
Return an estimation of the cost of using the positions of
this
Spans for any single document, but only after
Scorer.asTwoPhaseIterator() returned null . |
float |
score()
Returns the score of the current document matching the query.
|
protected float |
scoreCurrentDoc()
Score the current doc.
|
protected void |
setFreqCurrentDoc()
Sets
freq and numMatches for the current document. |
float |
sloppyFreq()
Returns the intermediate "sloppy freq" adjusted for edit distance
|
abstract int |
startPosition()
Returns the start position in the current doc, or -1 when
nextStartPosition() was not yet called on the current doc. |
String |
toString() |
abstract int |
width()
Return the width of the match, which is typically used to compute
the
slop factor . |
asTwoPhaseIterator, getChildren, getWeight
advance, all, cost, docID, empty, nextDoc, slowAdvance
public static final int NO_MORE_POSITIONS
protected final Similarity.SimScorer docScorer
protected float freq
protected int numMatches
protected Spans(SpanWeight weight, Similarity.SimScorer docScorer)
public abstract int nextStartPosition() throws IOException
NO_MORE_POSITIONS
.IOException
public abstract int startPosition()
nextStartPosition()
was not yet called on the current doc.
After the last start/end position at the current doc this returns NO_MORE_POSITIONS
.public abstract int endPosition()
nextStartPosition()
was not yet called on the current doc.
After the last start/end position at the current doc this returns NO_MORE_POSITIONS
.public abstract int width()
slop factor
. It is only legal
to call this method when the iterator is on a valid doc ID and positioned.
The return value must be positive, and lower values means that the match is
better.public abstract void collect(SpanCollector collector) throws IOException
nextStartPosition()
, and before
NO_MORE_POSITIONS
has been reached.collector
- a SpanCollectorIOException
public abstract float positionsCost()
Spans
for any single document, but only after
Scorer.asTwoPhaseIterator()
returned null
.
Otherwise this method should not be called.
The returned value is independent of the current document.protected final void setFreqCurrentDoc() throws IOException
IOException
protected void doStartCurrentDoc() throws IOException
IOException
protected void doCurrentSpans() throws IOException
IOException
protected float scoreCurrentDoc() throws IOException
freq
.IOException
public final float score() throws IOException
Scorer
DocIdSetIterator.nextDoc()
or DocIdSetIterator.advance(int)
is called the first time, or when called from within
LeafCollector.collect(int)
.score
in class Scorer
IOException
public final int freq() throws IOException
Scorer
freq
in class Scorer
IOException
public final float sloppyFreq() throws IOException
IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.