public class NearSpansOrdered extends ConjunctionSpans
The formed spans only contains minimum slop matches.
The matching slop is computed from the distance(s) between
the non overlapping matching Spans.
Successive matches are always formed from the successive Spans
of the SpanNearQuery.
The formed spans may contain overlaps when the slop is at least 1. For example, when querying using
t1 t2 t3with slop at least 1, the fragment:
t1 t2 t1 t3 t2 t3matches twice:
t1 t2 .. t3
t1 .. t2 t3Expert: Only public for subclassing. Most implementations should not need this class
Modifier and Type | Field and Description |
---|---|
private int |
allowedSlop |
protected int |
matchEnd |
protected int |
matchStart |
protected int |
matchWidth |
atFirstInCurrentDoc, conjunction, oneExhaustedInCurrentDoc, subSpans
NO_MORE_POSITIONS
NO_MORE_DOCS
Constructor and Description |
---|
NearSpansOrdered(int allowedSlop,
java.util.List<Spans> subSpans) |
Modifier and Type | Method and Description |
---|---|
private static int |
advancePosition(Spans spans,
int position) |
void |
collect(SpanCollector collector)
Collect postings data from the leaves of the current Spans.
|
int |
endPosition()
Returns the end position for the current start position, or -1 when
Spans.nextStartPosition() was not yet called on the current doc. |
int |
nextStartPosition()
Returns the next start position for the current doc.
|
int |
startPosition()
Returns the start position in the current doc, or -1 when
Spans.nextStartPosition() was not yet called on the current doc. |
private boolean |
stretchToOrder()
Order the subSpans within the same document by using nextStartPosition on all subSpans
after the first as little as necessary.
|
(package private) boolean |
twoPhaseCurrentDocMatches() |
private boolean |
unpositioned() |
int |
width()
Return the width of the match, which is typically used to sloppy freq.
|
advance, asTwoPhaseIterator, cost, docID, getSubSpans, nextDoc, positionsCost, toMatchDoc
doCurrentSpans, doStartCurrentDoc, toString
all, empty, range, slowAdvance
protected int matchStart
protected int matchEnd
protected int matchWidth
private final int allowedSlop
public NearSpansOrdered(int allowedSlop, java.util.List<Spans> subSpans) throws java.io.IOException
java.io.IOException
boolean twoPhaseCurrentDocMatches() throws java.io.IOException
twoPhaseCurrentDocMatches
in class ConjunctionSpans
java.io.IOException
private boolean unpositioned()
public int nextStartPosition() throws java.io.IOException
Spans
Spans.NO_MORE_POSITIONS
.nextStartPosition
in class Spans
java.io.IOException
private boolean stretchToOrder() throws java.io.IOException
java.io.IOException
private static int advancePosition(Spans spans, int position) throws java.io.IOException
java.io.IOException
public int startPosition()
Spans
Spans.nextStartPosition()
was not yet called on the current doc.
After the last start/end position at the current doc this returns Spans.NO_MORE_POSITIONS
.startPosition
in class Spans
public int endPosition()
Spans
Spans.nextStartPosition()
was not yet called on the current doc.
After the last start/end position at the current doc this returns Spans.NO_MORE_POSITIONS
.endPosition
in class Spans
public int width()
Spans
public void collect(SpanCollector collector) throws java.io.IOException
Spans
Spans.nextStartPosition()
, and before
Spans.NO_MORE_POSITIONS
has been reached.