public abstract class Spans extends DocIdSetIterator
Modifier and Type | Field and Description |
---|---|
static int |
NO_MORE_POSITIONS |
NO_MORE_DOCS
Constructor and Description |
---|
Spans() |
Modifier and Type | Method and Description |
---|---|
TwoPhaseIterator |
asTwoPhaseIterator()
Optional method: Return a
TwoPhaseIterator view of this
Spans . |
abstract int |
endPosition()
Returns the end position for the current start position, or -1 when
nextStartPosition() was not yet called on the current doc. |
abstract Collection<byte[]> |
getPayload()
Returns the payload data for the current start/end position.
|
abstract boolean |
isPayloadAvailable()
Checks if a payload can be loaded at the current start/end position.
|
abstract int |
nextStartPosition()
Returns the next start position for the current doc.
|
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() |
advance, all, cost, docID, empty, nextDoc, slowAdvance
public static final int NO_MORE_POSITIONS
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 Collection<byte[]> getPayload() throws IOException
nextStartPosition()
returned an available start position.
This method must not be called more than once after each call
of nextStartPosition()
. However, most payloads are loaded lazily,
so if the payload data for the current position is not needed,
this method may not be called at all for performance reasons.
IOException
- if there is a low-level I/O errorpublic abstract boolean isPayloadAvailable() throws IOException
Payloads can only be loaded once per call to
nextStartPosition()
.
IOException
public TwoPhaseIterator asTwoPhaseIterator()
TwoPhaseIterator
view of this
Spans
. A return value of null
indicates that
two-phase iteration is not supported.
Note that the returned TwoPhaseIterator
's
approximation
must
advance documents synchronously with this iterator:
advancing the approximation must
advance this iterator and vice-versa.
Implementing this method is typically useful on a Spans
that has a high per-document overhead for confirming matches.
The default implementation returns null
.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.