Ejemplo n.º 1
0
 @Override
 public void collect(int doc) throws IOException {
   if (values != null) {
     int ord = (int) ordinals.getOrd(doc);
     long parentIdx = parentIdsIndex.get(ord);
     if (parentIdx < 0) {
       final BytesRef bytes = values.getValueByOrd(ord);
       final int hash = values.currentValueHash();
       parentIdx = parentIds.add(bytes, hash);
       if (parentIdx < 0) {
         parentIdx = -parentIdx - 1;
         scores.increment(parentIdx, scorer.score());
         occurrences.increment(parentIdx, 1);
       } else {
         scores = bigArrays.grow(scores, parentIdx + 1);
         scores.set(parentIdx, scorer.score());
         occurrences = bigArrays.grow(occurrences, parentIdx + 1);
         occurrences.set(parentIdx, 1);
       }
       parentIdsIndex.set(ord, parentIdx);
     } else {
       scores.increment(parentIdx, scorer.score());
       occurrences.increment(parentIdx, 1);
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Utility method to increment the doc counts of the given bucket (identified by the bucket
  * ordinal)
  */
 protected final void incrementBucketDocCount(long bucketOrd, int inc) throws IOException {
   docCounts = bigArrays.grow(docCounts, bucketOrd + 1);
   docCounts.increment(bucketOrd, inc);
 }
Ejemplo n.º 3
0
 /**
  * Same as {@link #collectBucket(int, long)}, but doesn't check if the docCounts needs to be
  * re-sized.
  */
 protected final void collectExistingBucket(int doc, long bucketOrd) throws IOException {
   docCounts.increment(bucketOrd, 1);
   collectBucketNoCounts(doc, bucketOrd);
 }