Skip to content

Commit

Permalink
add some log
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Feb 5, 2025
1 parent 4e15957 commit 6aa0991
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

package org.opensearch.search.aggregations.bucket.range;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.BulkScorer;
import org.apache.lucene.search.CollectionTerminatedException;
Expand Down Expand Up @@ -260,6 +262,8 @@ public boolean equals(Object obj) {

private final FilterRewriteOptimizationContext filterRewriteOptimizationContext;

private final Logger logger = LogManager.getLogger(RangeAggregator.class);

public RangeAggregator(
String name,
AggregatorFactories factories,
Expand Down Expand Up @@ -318,11 +322,13 @@ public ScoreMode scoreMode() {
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException {
if (collectableSubAggregators == null) {
logger.debug("No sub-aggregators to collect");
if (segmentMatchAll(context, ctx)
&& filterRewriteOptimizationContext.tryOptimize(ctx, this::incrementBucketDocCount, false, collectableSubAggregators)) {
throw new CollectionTerminatedException();
}
} else {
logger.debug("Collecting sub-aggregators");
if (segmentMatchAll(context, ctx) && filterRewriteOptimizationContext.tryGetRanges(ctx, false, context)) {
List<Weight> weights = filterRewriteOptimizationContext.getWeights();
class SubLeafCollector implements LeafCollector {
Expand All @@ -334,7 +340,7 @@ public void setScorer(Scorable scorer) throws IOException {}

@Override
public void collect(int docId) throws IOException {
collectBucket(sub, docId, filterOrd);
collectBucket(subCollector, docId, filterOrd);
}
}
Bits live = ctx.reader().getLiveDocs();
Expand Down

0 comments on commit 6aa0991

Please sign in to comment.