forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sandesh Kumar <[email protected]>
- Loading branch information
Sandesh Kumar
committed
Nov 18, 2024
1 parent
a2a01f8
commit d7fbc39
Showing
7 changed files
with
216 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
server/src/main/java/org/opensearch/search/aggregations/StarTreeBucketCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.aggregations; | ||
|
||
import java.io.IOException; | ||
|
||
public abstract class StarTreeBucketCollector extends LeafBucketCollector { | ||
|
||
public abstract void collectStarEntry(int starTreeEntry, long bucket) throws IOException; | ||
} |
59 changes: 59 additions & 0 deletions
59
server/src/main/java/org/opensearch/search/aggregations/StarTreeLeafBucketCollectorBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
package org.opensearch.search.aggregations; | ||
|
||
import org.apache.lucene.search.Scorable; | ||
import org.opensearch.common.lucene.ScorerAware; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* A {@link LeafBucketCollector} that delegates all calls to the sub leaf | ||
* aggregator and sets the scorer on its source of values if it implements | ||
* {@link ScorerAware}. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class StarTreeLeafBucketCollectorBase extends StarTreeBucketCollector { | ||
private final LeafBucketCollector sub; | ||
private final ScorerAware values; | ||
|
||
/** | ||
* @param sub The leaf collector for sub aggregations. | ||
* @param values The values. {@link ScorerAware#setScorer} will be called automatically on them if they implement {@link ScorerAware}. | ||
*/ | ||
public StarTreeLeafBucketCollectorBase(LeafBucketCollector sub, Object values) { | ||
this.sub = sub; | ||
if (values instanceof ScorerAware) { | ||
this.values = (ScorerAware) values; | ||
} else { | ||
this.values = null; | ||
} | ||
} | ||
|
||
@Override | ||
public void setScorer(Scorable s) throws IOException { | ||
sub.setScorer(s); | ||
if (values != null) { | ||
values.setScorer(s); | ||
} | ||
} | ||
|
||
@Override | ||
public void collect(int doc, long bucket) throws IOException { | ||
sub.collect(doc, bucket); | ||
} | ||
|
||
@Override | ||
public void collectStarEntry(int starTreeEntry, long bucket) throws IOException {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters