From 04bce0e21b0cbb70ba0b6864e7bbd99c30c91930 Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Fri, 5 Jan 2024 12:09:08 -0800 Subject: [PATCH] Made QueryCollectorContext methods create and postProcess public Signed-off-by: Martin Gaievski --- CHANGELOG.md | 1 + .../search/query/QueryCollectorContext.java | 12 ++++++------ .../search/query/TopDocsCollectorContext.java | 14 +++++++------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7aa083eb2bcb..922827a29b538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -184,6 +184,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Automatically add scheme to discovery.ec2.endpoint ([#11512](https://github.com/opensearch-project/OpenSearch/pull/11512)) - Restore support for Java 8 for RestClient ([#11562](https://github.com/opensearch-project/OpenSearch/pull/11562)) - Add deleted doc count in _cat/shards ([#11678](https://github.com/opensearch-project/OpenSearch/pull/11678)) +- Refactor QueryCollectorContext to improve extensibility ([xxx](link)) ### Deprecated diff --git a/server/src/main/java/org/opensearch/search/query/QueryCollectorContext.java b/server/src/main/java/org/opensearch/search/query/QueryCollectorContext.java index 91762bee2ac08..7ee49269abe42 100644 --- a/server/src/main/java/org/opensearch/search/query/QueryCollectorContext.java +++ b/server/src/main/java/org/opensearch/search/query/QueryCollectorContext.java @@ -87,7 +87,7 @@ public ScoreMode scoreMode() { * Creates a collector that delegates documents to the provided in collector. * @param in The delegate collector */ - abstract Collector create(Collector in) throws IOException; + public abstract Collector create(Collector in) throws IOException; abstract CollectorManager createManager(CollectorManager in) throws IOException; @@ -116,7 +116,7 @@ protected InternalProfileCollectorManager createWithProfiler(InternalProfileColl * * @param result The query search result to populate */ - void postProcess(QuerySearchResult result) throws IOException {} + public void postProcess(QuerySearchResult result) throws IOException {} /** * Creates the collector tree from the provided collectors @@ -149,7 +149,7 @@ static InternalProfileCollector createQueryCollectorWithProfiler(List createManager(CollectorManager subCollectors = new ArrayList<>(); subCollectors.add(in); for (CollectorManager manager : subs) { @@ -267,7 +267,7 @@ static QueryCollectorContext createEarlyTerminationCollectorContext(int numHits) * can terminate the collection independently of the provided in {@link Collector}. */ @Override - Collector create(Collector in) { + public Collector create(Collector in) { assert collector == null; List subCollectors = new ArrayList<>(); diff --git a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java index 65d3948c8401e..6d61f7ad76b41 100644 --- a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java +++ b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java @@ -205,13 +205,13 @@ CollectorManager createManager(CollectorManager