override needsScore() on ValueCountAggregator (#62683) (#62745)

This commit is contained in:
Ignacio Vera 2020-09-22 08:47:16 +02:00 committed by GitHub
parent 28503f04f7
commit 265387f348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ package org.elasticsearch.search.aggregations.metrics;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.ScoreMode;
import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.LongArray;
@ -125,6 +126,11 @@ public class ValueCountAggregator extends NumericMetricsAggregator.SingleValue {
return new InternalValueCount(name, counts.get(bucket), metadata());
}
@Override
public ScoreMode scoreMode() {
return valuesSource != null && valuesSource.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
@Override
public InternalAggregation buildEmptyAggregation() {
return new InternalValueCount(name, 0L, metadata());