public boolean skipTo(int target) throws IOException { if (!spans.skipTo(target)) return false; if (spans.end() <= end) // there is a match return true; return next(); // scan to next match }
public boolean skipTo(int target) throws IOException { if (firstTime) { for (int i = 0; i < all.size(); i++) { Spans spans = (Spans)all.get(i); if (spans.skipTo(target)) { // skip each spans in all queue.put(spans); // build queue } else { all.remove(i--); } } firstTime = false; } else { while (queue.size() != 0 && top().doc() < target) { if (top().skipTo(target)) { queue.adjustTop(); } else { all.remove(queue.pop()); } } } return queue.size() != 0; }
public boolean skipTo(int target) throws IOException { more = spans.skipTo(target); if (!more) return false; freq = 0.0f; doc = spans.doc(); while (more && spans.doc() == target) { freq += getSimilarity().sloppyFreq(spans.end() - spans.start()); more = spans.next(); } return more || freq != 0.0f; }
public boolean skipTo(int target) throws IOException { if (moreInclude) // skip include moreInclude = includeSpans.skipTo(target); if (!moreInclude) return false; if (moreExclude // skip exclude && includeSpans.doc() > excludeSpans.doc()) moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) return true; // we found a match return next(); // scan to next match }
public boolean skipTo(int target) throws IOException { if (length != -1) // subtract old length totalLength -= length; boolean more = spans.skipTo(target); // skip if (more) { length = end() - start(); // compute new length totalLength += length; // add new length to total if (max == null || doc() > max.doc() || // maintain max (doc() == max.doc() && end() > max.end())) max = this; } return more; }
public boolean next() throws IOException { if (moreInclude) // move to next include moreInclude = includeSpans.next(); while (moreInclude && moreExclude) { if (includeSpans.doc() > excludeSpans.doc()) // skip exclude moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) break; // we found a match moreInclude = includeSpans.next(); // intersected: keep scanning } return moreInclude; }
public boolean skipTo(int target) throws IOException { if (moreInclude) // skip include moreInclude = includeSpans.skipTo(target); if (!moreInclude) return false; if (moreExclude // skip exclude && includeSpans.doc() > excludeSpans.doc()) moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) return true; // we found a match return next(); // scan to next match }
public boolean next() throws IOException { if (moreInclude) // move to next include moreInclude = includeSpans.next(); while (moreInclude && moreExclude) { if (includeSpans.doc() > excludeSpans.doc()) // skip exclude moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) break; // we found a match moreInclude = includeSpans.next(); // intersected: keep scanning } return moreInclude; }
public boolean skipTo(int target) throws IOException { if (moreInclude) // skip include moreInclude = includeSpans.skipTo(target); if (!moreInclude) return false; if (moreExclude // skip exclude && includeSpans.doc() > excludeSpans.doc()) moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) return true; // we found a match return next(); // scan to next match }
public boolean next() throws IOException { if (moreInclude) // move to next include moreInclude = includeSpans.next(); while (moreInclude && moreExclude) { if (includeSpans.doc() > excludeSpans.doc()) // skip exclude moreExclude = excludeSpans.skipTo(includeSpans.doc()); while (moreExclude // while exclude is before && includeSpans.doc() == excludeSpans.doc() && excludeSpans.end() <= includeSpans.start()) { moreExclude = excludeSpans.next(); // increment exclude } if (!moreExclude // if no intersection || includeSpans.doc() != excludeSpans.doc() || includeSpans.end() <= excludeSpans.start()) break; // we found a match moreInclude = includeSpans.next(); // intersected: keep scanning } return moreInclude; }