Skip to content

Commit

Permalink
Remove unused method (elastic#71969)
Browse files Browse the repository at this point in the history
Removes the unused `LeafBucketCollector#wrap` method. Its been entirely
replaced by `MultiBucketCollector#wrap`.
  • Loading branch information
nik9000 authored Apr 22, 2021
1 parent f3c175c commit 9129dcd
Showing 1 changed file with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import org.elasticsearch.search.aggregations.bucket.terms.LongKeyedBucketOrds;

import java.io.IOException;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

/**
* Collects results for a particular segment. See the docs for
Expand Down Expand Up @@ -44,36 +42,6 @@ public boolean isNoop() {
}
};

public static LeafBucketCollector wrap(Iterable<LeafBucketCollector> collectors) {
final Stream<LeafBucketCollector> actualCollectors = StreamSupport.stream(collectors.spliterator(), false)
.filter(c -> c != NO_OP_COLLECTOR);
final LeafBucketCollector[] colls = actualCollectors.toArray(size -> new LeafBucketCollector[size]);
switch (colls.length) {
case 0:
return NO_OP_COLLECTOR;
case 1:
return colls[0];
default:
return new LeafBucketCollector() {

@Override
public void setScorer(Scorable s) throws IOException {
for (LeafBucketCollector c : colls) {
c.setScorer(s);
}
}

@Override
public void collect(int doc, long bucket) throws IOException {
for (LeafBucketCollector c : colls) {
c.collect(doc, bucket);
}
}

};
}
}

/**
* Collect the given {@code doc} in the bucket owned by
* {@code owningBucketOrd}.
Expand Down

0 comments on commit 9129dcd

Please sign in to comment.