Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: enable geo_shape for geo compute #970

Merged
merged 1 commit into from
Jul 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public static void checkComputationRequest(Request request, CollectionReference
}
if (computationRequest.metric.equals(ComputationEnum.GEOBBOX) || computationRequest.metric.equals(ComputationEnum.GEOCENTROID)) {
FieldType fieldType = CollectionReferenceManager.getInstance().getType(collectionReference, computationRequest.field, false);
if (!FieldType.GEO_POINT.equals(fieldType) && !FieldType.UNKNOWN.equals(fieldType)) {
throw new InvalidParameterException(INVALID_COMPUTE_REQUEST + "`" + computationRequest.metric + "` must be applied on a geo-point field");
if (!FieldType.GEO_POINT.equals(fieldType) && !FieldType.GEO_SHAPE.equals(fieldType) && !FieldType.UNKNOWN.equals(fieldType)) {
throw new InvalidParameterException(INVALID_COMPUTE_REQUEST + "`" + computationRequest.metric + "` must be applied on a geo-point or a geo-shape field");
}
} else if (!computationRequest.metric.equals(ComputationEnum.CARDINALITY)) {
// Except for CARDINALITY, GEOBBOX and GEOCENTROID, the field on which the metric is computed should be numeric or date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void testInvalidComputationRequest() throws Exception {
handleInvalidComputationRequest(post(computationRequest));
handleInvalidComputationRequest(get(computationRequest.field, computationRequest.metric.value()));

computationRequest.field = "geo_params.geometry";
computationRequest.field = "params.job";
computationRequest.metric = ComputationEnum.GEOBBOX;
handleInvalidComputationRequest(post(computationRequest));
handleInvalidComputationRequest(get(computationRequest.field, computationRequest.metric.value()));
Expand Down
Loading