Fix identation

This commit is contained in:
Martijn van Groningen 2015-01-14 09:45:23 +01:00
parent eaa1674d6d
commit 12a2e761c5

View File

@ -193,18 +193,20 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
} }
//replay any deferred collections //replay any deferred collections
runDeferredCollections(survivingBucketOrds); runDeferredCollections(survivingBucketOrds);
//Now build the aggs //Now build the aggs
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
Bucket bucket = list[i]; Bucket bucket = list[i];
bucket.aggregations = bucket.docCount == 0 ? bucketEmptyAggregations() : bucketAggregations(bucket.bucketOrd); bucket.aggregations = bucket.docCount == 0 ? bucketEmptyAggregations() : bucketAggregations(bucket.bucketOrd);
bucket.docCountError = 0; bucket.docCountError = 0;
} }
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getShardSize(), bucketCountThresholds.getMinDocCount(), Arrays.asList(list), showTermDocCountError, 0, otherDocCount, metaData()); return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getShardSize(), bucketCountThresholds.getMinDocCount(), Arrays.asList(list), showTermDocCountError, 0, otherDocCount, metaData());
} }
/** This is used internally only, just for compare using global ordinal instead of term bytes in the PQ */ /**
* This is used internally only, just for compare using global ordinal instead of term bytes in the PQ
*/
static class OrdBucket extends InternalTerms.Bucket { static class OrdBucket extends InternalTerms.Bucket {
long globalOrd; long globalOrd;
@ -215,7 +217,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
@Override @Override
int compareTerm(Terms.Bucket other) { int compareTerm(Terms.Bucket other) {
return Long.compare(globalOrd, ((OrdBucket)other).globalOrd); return Long.compare(globalOrd, ((OrdBucket) other).globalOrd);
} }
@Override @Override
@ -301,17 +303,17 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
public void collect(int doc) throws IOException { public void collect(int doc) throws IOException {
ords.setDocument(doc); ords.setDocument(doc);
final int numOrds = ords.cardinality(); final int numOrds = ords.cardinality();
for (int i = 0; i < numOrds; i++) { for (int i = 0; i < numOrds; i++) {
final long globalOrd = ords.ordAt(i); final long globalOrd = ords.ordAt(i);
long bucketOrd = bucketOrds.add(globalOrd); long bucketOrd = bucketOrds.add(globalOrd);
if (bucketOrd < 0) { if (bucketOrd < 0) {
bucketOrd = -1 - bucketOrd; bucketOrd = -1 - bucketOrd;
collectExistingBucket(doc, bucketOrd); collectExistingBucket(doc, bucketOrd);
} else { } else {
collectBucket(doc, bucketOrd); collectBucket(doc, bucketOrd);
} }
} }
} }
}; };
} }
} }
@ -351,7 +353,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
final SortedDocValues singleValues = DocValues.unwrapSingleton(segmentOrds); final SortedDocValues singleValues = DocValues.unwrapSingleton(segmentOrds);
if (singleValues != null) { if (singleValues != null) {
return new Collector() { return new Collector() {
@Override @Override
public void collect(int doc) throws IOException { public void collect(int doc) throws IOException {
final int ord = singleValues.getOrd(doc); final int ord = singleValues.getOrd(doc);
segmentDocCounts.increment(ord + 1, 1); segmentDocCounts.increment(ord + 1, 1);
@ -362,7 +364,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
public void collect(int doc) throws IOException { public void collect(int doc) throws IOException {
segmentOrds.setDocument(doc); segmentOrds.setDocument(doc);
final int numOrds = segmentOrds.cardinality(); final int numOrds = segmentOrds.cardinality();
for (int i = 0; i < numOrds; i++) { for (int i = 0; i < numOrds; i++) {
final long segmentOrd = segmentOrds.ordAt(i); final long segmentOrd = segmentOrds.ordAt(i);
segmentDocCounts.increment(segmentOrd + 1, 1); segmentDocCounts.increment(segmentOrd + 1, 1);
} }
@ -380,7 +382,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
globalOrds = valuesSource.globalOrdinalsValues(); globalOrds = valuesSource.globalOrdinalsValues();
segmentOrds = valuesSource.ordinalsValues(); segmentOrds = valuesSource.ordinalsValues();
collector = newCollector(segmentOrds); collector = newCollector(segmentOrds);
} }
@Override @Override
protected void doPostCollection() { protected void doPostCollection() {
@ -406,6 +408,8 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
mapping = null; mapping = null;
} }
for (long i = 1; i < segmentDocCounts.size(); i++) { for (long i = 1; i < segmentDocCounts.size(); i++) {
// We use set(...) here, because we need to reset the slow to 0.
// segmentDocCounts get reused over the segments and otherwise counts would be too high.
final int inc = segmentDocCounts.set(i, 0); final int inc = segmentDocCounts.set(i, 0);
if (inc == 0) { if (inc == 0) {
continue; continue;
@ -456,8 +460,8 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
if (accepted.get(ord)) { if (accepted.get(ord)) {
ords[cardinality++] = ord; ords[cardinality++] = ord;
} }
}
} }
}
@Override @Override
public int cardinality() { public int cardinality() {