final void add(int slot, int doc, float score) { bottom = pq.add(new Entry(slot, docBase + doc, score)); queueFull = totalHits == numHits; }
private DisjunctionMatchesIterator(List<MatchesIterator> matches) throws IOException { queue = new PriorityQueue<MatchesIterator>(matches.size()){ @Override protected boolean lessThan(MatchesIterator a, MatchesIterator b) { return a.startPosition() < b.startPosition() || (a.startPosition() == b.startPosition() && a.endPosition() < b.endPosition()) || (a.startPosition() == b.startPosition() && a.endPosition() == b.endPosition()); } }; for (MatchesIterator mi : matches) { if (mi.next()) { queue.add(mi); } } }
/** * Adds an Object to a PriorityQueue in log(size) time. * It returns the object (if any) that was * dropped off the heap because it was full. This can be * the given parameter (in case it is smaller than the * full heap's minimum, and couldn't be added), or another * object that was previously the smallest value in the * heap and now has been replaced by a larger one, or null * if the queue wasn't yet full with maxSize elements. */ public T insertWithOverflow(T element) { if (size < maxSize) { add(element); return null; } else if (size > 0 && !lessThan(element, heap[1])) { T ret = heap[1]; heap[1] = element; updateTop(); return ret; } else { return element; } }
queue.add(sub);
queue.add(sub);
@Override public int freq() throws IOException { int doc = docID(); if (doc == posQueueDoc) { return freq; } freq = 0; started = false; posQueue.clear(); for (PostingsAndPosition pp : subs) { if (pp.pe.docID() == doc) { pp.pos = pp.pe.nextPosition(); pp.upto = pp.pe.freq(); posQueue.add(pp); freq += pp.upto; } } return freq; }
unverifiedMatches.add(w);
if (shard.scoreDocs != null && shard.scoreDocs.length > 0) { availHitCount += shard.scoreDocs.length; queue.add(new ShardRef(shardIDX, setShardIndex == false)); maxScore = Math.max(maxScore, shard.getMaxScore());
assert leaf.values[j] != null; queue.add(leaf); builders[i] = PackedLongValues.monotonicBuilder(PackedInts.COMPACT);
score = scorer.score(); bottom = pq.add(new Entry(slot, docBase + doc, score)); queueFull = collectedHits == numHits; if (queueFull) {
private void updateTop(CandidateSet[] candidates, Candidate[] path, PriorityQueue<Correction> corrections, double cutoffScore, double score) throws IOException { score = Math.exp(score); assert Math.abs(score - score(path, candidates)) < 0.00001; if (score > cutoffScore) { if (corrections.size() < maxNumCorrections) { Candidate[] c = new Candidate[candidates.length]; System.arraycopy(path, 0, c, 0, path.length); corrections.add(new Correction(score, c)); } else if (corrections.top().compareTo(score, path) < 0) { Correction top = corrections.top(); System.arraycopy(path, 0, top.candidates, 0, path.length); top.score = score; corrections.updateTop(); } } }
if (shard.scoreDocs != null && shard.scoreDocs.length > 0) { availHitCount += shard.scoreDocs.length; queue.add(new ShardRef(shardIDX, setShardIndex == false)); maxScore = Math.max(maxScore, shard.getMaxScore());
InternalAutoDateHistogram histogram = (InternalAutoDateHistogram) aggregation; if (histogram.buckets.isEmpty() == false) { pq.add(new IteratorAndCurrent(histogram.buckets.iterator()));
InternalHistogram histogram = (InternalHistogram) aggregation; if (histogram.buckets.isEmpty() == false) { pq.add(new IteratorAndCurrent(histogram.buckets.iterator()));
InternalDateHistogram histogram = (InternalDateHistogram) aggregation; if (histogram.buckets.isEmpty() == false) { pq.add(new IteratorAndCurrent(histogram.buckets.iterator()));
TermsEnumIndex sub = new TermsEnumIndex(subs[segmentMap.newToOld(i)], i); if (sub.next() != null) { queue.add(sub);
/** Pushes all previously pop'd enums back into the docIDQueue */ private void pushCurrentDoc() { for(int i=0;i<numSubsOnDoc;i++) { docIDQueue.add(subsOnDoc[i]); } numSubsOnDoc = 0; }
@SuppressWarnings("unchecked") public MergedIterator(final List<Iterator<T>> iterators, final Comparator<T> comparator) { this(iterators.size(), comparator); for (Iterator<T> iterator : iterators) { IteratorNode ctx = new IteratorNode(iterator); if (ctx.fetch()) _queue.add(ctx); } }
@SuppressWarnings("unchecked") public MergedIterator(final Iterator<T>[] iterators, final Comparator<T> comparator) { this(iterators.length, comparator); for (Iterator<T> iterator : iterators) { IteratorNode ctx = new IteratorNode(iterator); if (ctx.fetch()) _queue.add(ctx); } }
private void reset() throws IOException { intervalQueue.clear(); for (DisiWrapper dw = disiQueue.topList(); dw != null; dw = dw.next) { dw.intervals.nextInterval(); intervalQueue.add(dw.intervals); } current = EMPTY; }