From 2e2dab0fb579b2630c7b0277572217cf9d442501 Mon Sep 17 00:00:00 2001 From: Sandesh Kumar Date: Thu, 15 Feb 2024 14:52:05 -0800 Subject: [PATCH] Remove extra checks Signed-off-by: Sandesh Kumar --- .../GlobalOrdinalsStringTermsAggregator.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java index a69e55181fcd2..c5bc7caa718a0 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java @@ -220,9 +220,7 @@ public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, LeafBucketCol SortedSetDocValues globalOrds = valuesSource.globalOrdinalsValues(ctx); collectionStrategy.globalOrdsReady(globalOrds); - if (collectionStrategy instanceof DenseGlobalOrds - && this.resultStrategy instanceof StandardTermsResults - && sub == LeafBucketCollector.NO_OP_COLLECTOR) { + if (collectionStrategy instanceof DenseGlobalOrds && sub == LeafBucketCollector.NO_OP_COLLECTOR) { LeafBucketCollector termDocFreqCollector = termDocFreqCollector( ctx, globalOrds, @@ -432,18 +430,13 @@ public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, LeafBucketCol assert sub == LeafBucketCollector.NO_OP_COLLECTOR; mapping = valuesSource.globalOrdinalsMapping(ctx); - if (this.resultStrategy instanceof StandardTermsResults) { - LeafBucketCollector termDocFreqCollector = this.termDocFreqCollector( - ctx, - segmentOrds, - (ord, docCount) -> incrementBucketDocCount( - collectionStrategy.globalOrdToBucketOrd(0, mapping.applyAsLong(ord)), - docCount - ) - ); - if (termDocFreqCollector != null) { - return termDocFreqCollector; - } + LeafBucketCollector termDocFreqCollector = this.termDocFreqCollector( + ctx, + segmentOrds, + (ord, docCount) -> incrementBucketDocCount(collectionStrategy.globalOrdToBucketOrd(0, mapping.applyAsLong(ord)), docCount) + ); + if (termDocFreqCollector != null) { + return termDocFreqCollector; } final SortedDocValues singleValues = DocValues.unwrapSingleton(segmentOrds);