コード例 #1
0
  @Override
  public void collect(int doc, long owningBucketOrdinal) throws IOException {
    assert owningBucketOrdinal == 0;
    final LongValues values = valuesSource.longValues();
    final int valuesCount = values.setDocument(doc);

    long previousKey = Long.MIN_VALUE;
    for (int i = 0; i < valuesCount; ++i) {
      long value = values.nextValue();
      long key = rounding.roundKey(value);
      assert key >= previousKey;
      if (key == previousKey) {
        continue;
      }
      long bucketOrd = bucketOrds.add(key);
      if (bucketOrd < 0) { // already seen
        bucketOrd = -1 - bucketOrd;
      }
      collectBucket(doc, bucketOrd);
      previousKey = key;
    }
  }
コード例 #2
0
 @Override
 public void setNextReader(AtomicReaderContext reader) {
   values = valuesSource.longValues();
 }