@Override public int startPosition() { assert minPositionCell() != null; return atFirstInCurrentDoc ? -1 : oneExhaustedInCurrentDoc ? NO_MORE_POSITIONS : minPositionCell().startPosition(); }
@Override public int startPosition() { assert minPositionCell() != null; return atFirstInCurrentDoc ? -1 : oneExhaustedInCurrentDoc ? NO_MORE_POSITIONS : minPositionCell().startPosition(); }
private boolean atMatch() { assert minPositionCell().docID() == maxEndPositionCell.docID(); return (maxEndPositionCell.endPosition() - minPositionCell().startPosition() - totalSpanLength) <= allowedSlop; }
private boolean atMatch() { assert minPositionCell().docID() == maxEndPositionCell.docID(); return (maxEndPositionCell.endPosition() - minPositionCell().startPosition() - totalSpanLength) <= allowedSlop; }
@Override public int width() { return maxEndPositionCell.startPosition() - minPositionCell().startPosition(); }
@Override public int nextStartPosition() throws IOException { if (atFirstInCurrentDoc) { atFirstInCurrentDoc = false; return minPositionCell().startPosition(); } while (minPositionCell().startPosition() == -1) { // initially at current doc minPositionCell().nextStartPosition(); spanPositionQueue.updateTop(); } assert minPositionCell().startPosition() != NO_MORE_POSITIONS; while (true) { if (minPositionCell().nextStartPosition() == NO_MORE_POSITIONS) { oneExhaustedInCurrentDoc = true; return NO_MORE_POSITIONS; } spanPositionQueue.updateTop(); if (atMatch()) { return minPositionCell().startPosition(); } } }
@Override public int nextStartPosition() throws IOException { if (atFirstInCurrentDoc) { atFirstInCurrentDoc = false; return minPositionCell().startPosition(); } while (minPositionCell().startPosition() == -1) { // initially at current doc minPositionCell().nextStartPosition(); spanPositionQueue.updateTop(); } assert minPositionCell().startPosition() != NO_MORE_POSITIONS; while (true) { if (minPositionCell().nextStartPosition() == NO_MORE_POSITIONS) { oneExhaustedInCurrentDoc = true; return NO_MORE_POSITIONS; } spanPositionQueue.updateTop(); if (atMatch()) { return minPositionCell().startPosition(); } } }
@Override public int width() { return maxEndPositionCell.startPosition() - minPositionCell().startPosition(); }
@Override boolean twoPhaseCurrentDocMatches() throws IOException { // at doc with all subSpans subSpanCellsToPositionQueue(); while (true) { if (atMatch()) { atFirstInCurrentDoc = true; oneExhaustedInCurrentDoc = false; return true; } assert minPositionCell().startPosition() != NO_MORE_POSITIONS; if (minPositionCell().nextStartPosition() != NO_MORE_POSITIONS) { spanPositionQueue.updateTop(); } else { // exhausted a subSpan in current doc return false; } } }
@Override boolean twoPhaseCurrentDocMatches() throws IOException { // at doc with all subSpans subSpanCellsToPositionQueue(); while (true) { if (atMatch()) { atFirstInCurrentDoc = true; oneExhaustedInCurrentDoc = false; return true; } assert minPositionCell().startPosition() != NO_MORE_POSITIONS; if (minPositionCell().nextStartPosition() != NO_MORE_POSITIONS) { spanPositionQueue.updateTop(); } else { // exhausted a subSpan in current doc return false; } } }