Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Faster `terms` query creation for `keyword` field with index and docValues enabled ([#19350](https://github.com/opensearch-project/OpenSearch/pull/19350))
- Refactor to move prepareIndex and prepareDelete methods to Engine class ([#19551](https://github.com/opensearch-project/OpenSearch/pull/19551))
- Omit maxScoreCollector in SimpleTopDocsCollectorContext when concurrent segment search enabled ([#19584](https://github.com/opensearch-project/OpenSearch/pull/19584))
- Remove MultiCollectorWrapper and use MultiCollector in Lucene instead ([#19595](https://github.com/opensearch-project/OpenSearch/pull/19595))

### Fixed
- Fix Allocation and Rebalance Constraints of WeightFunction are incorrectly reset ([#19012](https://github.com/opensearch-project/OpenSearch/pull/19012))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Supplier;
Expand Down Expand Up @@ -322,15 +323,15 @@ public Collector newCollector() throws IOException {
maxScoreCollector = new MaxScoreCollector();
}

return MultiCollectorWrapper.wrap(collapseContext.createTopDocs(sort, numHits, searchAfter), maxScoreCollector);
return MultiCollector.wrap(collapseContext.createTopDocs(sort, numHits, searchAfter), maxScoreCollector);
}

@Override
public ReduceableSearchResult reduce(Collection<Collector> collectors) throws IOException {
final Collection<Collector> subs = new ArrayList<>();
for (final Collector collector : collectors) {
if (collector instanceof MultiCollectorWrapper) {
subs.addAll(((MultiCollectorWrapper) collector).getCollectors());
if (collector instanceof MultiCollector m) {
subs.addAll(List.of(m.getCollectors()));
} else {
subs.add(collector);
}
Expand Down Expand Up @@ -549,7 +550,7 @@ public Collector newCollector() throws IOException {
maxScoreCollector = new MaxScoreCollector();
}

return MultiCollectorWrapper.wrap(manager.newCollector(), maxScoreCollector);
return MultiCollector.wrap(manager.newCollector(), maxScoreCollector);
}

@SuppressWarnings("unchecked")
Expand All @@ -559,8 +560,8 @@ public ReduceableSearchResult reduce(Collection<Collector> collectors) throws IO
final Collection<MaxScoreCollector> maxScoreCollectors = new ArrayList<>();

for (final Collector collector : collectors) {
if (collector instanceof MultiCollectorWrapper) {
for (final Collector sub : (((MultiCollectorWrapper) collector).getCollectors())) {
if (collector instanceof MultiCollector m) {
for (final Collector sub : (m.getCollectors())) {
if (sub instanceof TopDocsCollector<?>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to your code change, but can you also do Pattern Matching for instanceof in consecutive lines of code as well in the same method.

topDocsCollectors.add((TopDocsCollector<?>) sub);
} else if (sub instanceof MaxScoreCollector) {
Expand Down
Loading