Skip to content

Commit

Permalink
accommodate geo distance agg
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed May 29, 2024
1 parent ed79e02 commit c7043e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.opensearch.search.aggregations.AggregatorFactories;
import org.opensearch.search.aggregations.CardinalityUpperBound;
import org.opensearch.search.aggregations.support.ValuesSource;
import org.opensearch.search.aggregations.support.ValuesSourceConfig;
import org.opensearch.search.internal.SearchContext;

import java.io.IOException;
Expand All @@ -64,6 +65,7 @@ Aggregator build(
SearchContext context,
Aggregator parent,
CardinalityUpperBound cardinality,
Map<String, Object> metadata
Map<String, Object> metadata,
ValuesSourceConfig valuesSourceConfig
) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public static void registerAggregators(ValuesSourceRegistry.Builder builder) {
context,
parent,
cardinality,
metadata) -> {
metadata,
config) -> {
DistanceSource distanceSource = new DistanceSource((ValuesSource.GeoPoint) valuesSource, distanceType, origin, units);
return new RangeAggregator(
name,
Expand All @@ -96,7 +97,7 @@ public static void registerAggregators(ValuesSourceRegistry.Builder builder) {
parent,
cardinality,
metadata,
null
config
);
},
true
Expand Down Expand Up @@ -169,7 +170,8 @@ protected Aggregator doCreateInternal(
searchContext,
parent,
cardinality,
metadata
metadata,
config
);
}

Expand Down

0 comments on commit c7043e4

Please sign in to comment.