public boolean next() throws IOException { if (firstTime) { more = spans.next(); firstTime = false; } return setFreqCurrentDoc(); }
public boolean next() throws IOException { while (spans.next()) { // scan to next match if (end() <= end) return true; } return false; }
public boolean next() throws IOException { if (firstTime) { more = spans.next(); firstTime = false; } return setFreqCurrentDoc(); }
public boolean next() throws IOException { if (firstTime) { // first time -- initialize for (int i = 0; i < all.size(); i++) { Spans spans = (Spans)all.get(i); if (spans.next()) { // move to first entry queue.put(spans); // build queue } else { all.remove(i--); } } firstTime = false; return queue.size() != 0; } if (queue.size() == 0) { // all done return false; } if (top().next()) { // move to next queue.adjustTop(); return true; } all.remove(queue.pop()); // exhausted a clause return queue.size() != 0; }
public boolean next() throws IOException { if (firstTime) { more = spans.next(); firstTime = false; } if (!more) return false; freq = 0.0f; doc = spans.doc(); while (more && doc == spans.doc()) { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } return more || freq != 0.0f; }
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; }
protected boolean setFreqCurrentDoc() throws IOException { if (! more) { return false; } doc = spans.doc(); freq = 0.0f; do { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } while (more && (doc == spans.doc())); return true; }
protected boolean setFreqCurrentDoc() throws IOException { if (! more) { return false; } doc = spans.doc(); freq = 0.0f; do { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } while (more && (doc == spans.doc())); return true; }
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 SpanFilterResult bitSpans(IndexReader reader) throws IOException { final OpenBitSet bits = new OpenBitSet(reader.maxDoc()); Spans spans = query.getSpans(reader); List tmp = new ArrayList(20); int currentDoc = -1; SpanFilterResult.PositionInfo currentInfo = null; while (spans.next()) { int doc = spans.doc(); bits.set(doc); if (currentDoc != doc) { currentInfo = new SpanFilterResult.PositionInfo(doc); tmp.add(currentInfo); currentDoc = doc; } currentInfo.addPosition(spans.start(), spans.end()); } return new SpanFilterResult(bits, tmp); }
public SpanFilterResult bitSpans(IndexReader reader) throws IOException { final OpenBitSet bits = new OpenBitSet(reader.maxDoc()); Spans spans = query.getSpans(reader); List tmp = new ArrayList(20); int currentDoc = -1; SpanFilterResult.PositionInfo currentInfo = null; while (spans.next()) { int doc = spans.doc(); bits.set(doc); if (currentDoc != doc) { currentInfo = new SpanFilterResult.PositionInfo(doc); tmp.add(currentInfo); currentDoc = doc; } currentInfo.addPosition(spans.start(), spans.end()); } return new SpanFilterResult(bits, tmp); }
public boolean next() throws IOException { if (length != -1) // subtract old length totalLength -= length; boolean more = spans.next(); // move to next 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; }
protected boolean setFreqCurrentDoc() throws IOException { if (!more) { return false; } doc = spans.doc(); freq = 0.0f; payloadScore = 0; payloadsSeen = 0; Similarity similarity1 = getSimilarity(); while (more && doc == spans.doc()) { int matchLength = spans.end() - spans.start(); freq += similarity1.sloppyFreq(matchLength); processPayload(similarity1); more = spans.next();//this moves positions to the next match in this document } return more || (freq != 0); }
protected boolean setFreqCurrentDoc() throws IOException { if (!more) { return false; } doc = spans.doc(); freq = 0.0f; payloadScore = 0; payloadsSeen = 0; Similarity similarity1 = getSimilarity(); while (more && doc == spans.doc()) { int matchLength = spans.end() - spans.start(); freq += similarity1.sloppyFreq(matchLength); processPayload(similarity1); more = spans.next();//this moves positions to the next match in this document } return more || (freq != 0); }
protected boolean setFreqCurrentDoc() throws IOException { if (!more) { return false; } doc = spans.doc(); freq = 0.0f; payloadScore = 0; payloadsSeen = 0; Similarity similarity1 = getSimilarity(); while (more && doc == spans.doc()) { int matchLength = spans.end() - spans.start(); freq += similarity1.sloppyFreq(matchLength); processPayload(similarity1); more = spans.next();//this moves positions to the next match in this document } return more || (freq != 0); }
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 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 (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; }