@Override public boolean skipToCandidate(final int target) throws IOException { return parentSpans.skipToCandidate(target); }
@Override public boolean skipToCandidate(int target) throws IOException { return spans.skipToCandidate(target); }
@Override public boolean skipToCandidate(final int target) throws IOException { return spans.skipToCandidate(target); }
@Override public boolean skipToCandidate(int target) throws IOException { return this.requiredSpans.skipToCandidate(target); }
@Override public boolean skipToCandidate(int target) throws IOException { if (!(includeSpans.skipToCandidate(target))) { return false; } if (includeSpans.doc() > excludeSpans.doc()) { moreExclude = excludeSpans.skipToCandidate(includeSpans.doc()); } return true; }
private boolean initSpanQueue(final int target) throws IOException { for (Spans subSpan : subSpans) { if (((target == -1) && subSpan.nextCandidateDocument()) || ((target != -1) && subSpan.skipToCandidate(target))) { queue.add(subSpan); } } return queue.size() != 0; }
@Override public boolean skipToCandidate(final int target) throws IOException { // reset matchNode, matchStart and matchEnd this.resetMatchNode(); this.resetStartAndEnd(); // Advance all the spans to or after the target for (int i = 0; i < subSpans.length; i++) { if (!subSpans[i].skipToCandidate(target)) { matchDoc = DocsAndNodesIterator.NO_MORE_DOC; return false; } } // Ensure that all the spans are on the same candidate return toSameCandidateDocument(); }
@Override public boolean nextCandidateDocument() throws IOException { if (!this.includeSpans.nextCandidateDocument()) { return false; } // advance the excluded span to or after the included candidate document if (includeSpans.doc() > excludeSpans.doc()) { moreExclude = excludeSpans.skipToCandidate(includeSpans.doc()); } return true; }
/** * Advance the spans to the same candidate document */ private boolean toSameCandidateDocument() throws IOException { docSorter.sort(0, subSpansSort.length); int firstIndex = 0; int maxDoc = subSpansSort[subSpansSort.length - 1].doc(); while (subSpansSort[firstIndex].doc() != maxDoc) { if (!subSpansSort[firstIndex].skipToCandidate(maxDoc)) { matchDoc = DocsAndNodesIterator.NO_MORE_DOC; return false; } maxDoc = subSpansSort[firstIndex].doc(); if (++firstIndex == subSpansSort.length) { firstIndex = 0; } } // assert doc - loop will be removed by jit if assert is disabled for (int i = 0; i < subSpansSort.length; i++) { assert (subSpansSort[i].doc() == maxDoc) : " NearSpansOrdered.toSameCandidateDocument() spans " + subSpansSort[0] + "\n at doc " + subSpansSort[i].doc() + ", but should be at " + maxDoc; } matchDoc = subSpans[0].doc(); return true; }
@Override public boolean skipToCandidate(int target) throws IOException { if (!qInitialized) { qInitialized = true; return initSpanQueue(target); } boolean skipCalled = false; while (queue.size() != 0 && top().doc() < target) { if (top().skipToCandidate(target)) { queue.updateTop(); } else { queue.pop(); } skipCalled = true; } if (skipCalled) { return queue.size() != 0; } return nextCandidateDocument(); }
else if (optionalSpans.doc() < doc && !optionalSpans.skipToCandidate(doc)) { isOptionalExhausted = true; return reqScore;