Move legacy geo_shape implementation to its own module (#77856) (#78735)

This commit moves the legacy geo_shape implementation to its own module and removes
the dependency on Spatial4J / JTS from server.
This commit is contained in:
Ignacio Vera 2021-10-11 08:23:22 +02:00 committed by GitHub
parent ca5480b9a8
commit 82dc997010
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 5634 additions and 3780 deletions

View file

@ -11,9 +11,9 @@ package org.elasticsearch.client.documentation;
import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.geo.ShapeRelation;
import org.elasticsearch.common.geo.builders.CoordinatesBuilder;
import org.elasticsearch.common.geo.builders.MultiPointBuilder;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.geometry.MultiPoint;
import org.elasticsearch.geometry.Point;
import org.elasticsearch.index.query.GeoShapeQueryBuilder;
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder;
@ -178,16 +178,16 @@ public class QueryDSLDocumentationTests extends ESTestCase {
public void testGeoShape() throws IOException {
{
// tag::geo_shape
List<Point> points = new ArrayList<>();
points.add(new Point(0, 0));
points.add(new Point(0, 10));
points.add(new Point(10, 10));
points.add(new Point(10, 0));
points.add(new Point(0, 0));
GeoShapeQueryBuilder qb = geoShapeQuery(
"pin.location", // <1>
new MultiPointBuilder( // <2>
new CoordinatesBuilder()
.coordinate(0, 0)
.coordinate(0, 10)
.coordinate(10, 10)
.coordinate(10, 0)
.coordinate(0, 0)
.build()));
"pin.location", // <1>
new MultiPoint(points) // <2>
);
qb.relation(ShapeRelation.WITHIN); // <3>
// end::geo_shape
}