@@ -206,23 +206,8 @@ public void testShapeFetchingPath() throws Exception {
206206 }
207207
208208 public void testRandomGeoCollectionQuery () throws Exception {
209- boolean usePrefixTrees = randomBoolean ();
210209 // Create a random geometry collection to index.
211- GeometryCollectionBuilder gcb ;
212- if (usePrefixTrees ) {
213- gcb = RandomShapeGenerator .createGeometryCollection (random ());
214- } else {
215- // vector strategy does not yet support multipoint queries
216- gcb = new GeometryCollectionBuilder ();
217- int numShapes = RandomNumbers .randomIntBetween (random (), 1 , 4 );
218- for (int i = 0 ; i < numShapes ; ++i ) {
219- ShapeBuilder shape ;
220- do {
221- shape = RandomShapeGenerator .createShape (random ());
222- } while (shape instanceof MultiPointBuilder );
223- gcb .shape (shape );
224- }
225- }
210+ GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());
226211 org .apache .lucene .geo .Polygon randomPoly = GeoTestUtil .nextPolygon ();
227212
228213 assumeTrue ("Skipping the check for the polygon with a degenerated dimension" ,
@@ -234,10 +219,9 @@ public void testRandomGeoCollectionQuery() throws Exception {
234219 }
235220 gcb .shape (new PolygonBuilder (cb ));
236221
237- logger .info ("Created Random GeometryCollection containing {} shapes using {} tree" , gcb .numShapes (),
238- usePrefixTrees ? "geohash" : "quadtree" );
222+ logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
239223
240- XContentBuilder mapping = createPrefixTreeMapping ( usePrefixTrees ? "geohash" : "quadtree" );
224+ XContentBuilder mapping = createRandomMapping ( );
241225 Settings settings = Settings .builder ().put ("index.number_of_shards" , 1 ).build ();
242226 client ().admin ().indices ().prepareCreate ("test" ).addMapping ("_doc" ,mapping ).setSettings (settings ).get ();
243227 ensureGreen ();
@@ -321,8 +305,7 @@ public void testEnvelopeSpanningDateline() throws Exception {
321305 }
322306
323307 public void testGeometryCollectionRelations () throws Exception {
324- XContentBuilder mapping = createPrefixTreeMapping (LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .GEOHASH );
325-
308+ XContentBuilder mapping = createDefaultMapping ();
326309 createIndex ("test" , Settings .builder ().put ("index.number_of_shards" , 1 ).build (), "doc" , mapping );
327310
328311 EnvelopeBuilder envelopeBuilder = new EnvelopeBuilder (new Coordinate (-10 , 10 ), new Coordinate (10 , -10 ));
@@ -441,13 +424,13 @@ public void testIndexedShapeReferenceSourceDisabled() throws Exception {
441424
442425 public void testReusableBuilder () throws IOException {
443426 PolygonBuilder polygon = new PolygonBuilder (new CoordinatesBuilder ()
444- .coordinate (170 , -10 ).coordinate (190 , -10 ).coordinate (190 , 10 ).coordinate (170 , 10 ).close ())
445- .hole (new LineStringBuilder (new CoordinatesBuilder ().coordinate (175 , -5 ).coordinate (185 , -5 ).coordinate (185 , 5 )
446- .coordinate (175 , 5 ).close ()));
427+ .coordinate (170 , -10 ).coordinate (190 , -10 ).coordinate (190 , 10 ).coordinate (170 , 10 ).close ())
428+ .hole (new LineStringBuilder (new CoordinatesBuilder ().coordinate (175 , -5 ).coordinate (185 , -5 ).coordinate (185 , 5 )
429+ .coordinate (175 , 5 ).close ()));
447430 assertUnmodified (polygon );
448431
449432 LineStringBuilder linestring = new LineStringBuilder (new CoordinatesBuilder ()
450- .coordinate (170 , -10 ).coordinate (190 , -10 ).coordinate (190 , 10 ).coordinate (170 , 10 ).close ());
433+ .coordinate (170 , -10 ).coordinate (190 , -10 ).coordinate (190 , 10 ).coordinate (170 , 10 ).close ());
451434 assertUnmodified (linestring );
452435 }
453436
@@ -534,13 +517,9 @@ public void testExistsQuery() throws Exception {
534517 GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());
535518 logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
536519
537- if (randomBoolean ()) {
538- client ().admin ().indices ().prepareCreate ("test" ).addMapping ("type" , "geo" , "type=geo_shape" )
539- .execute ().actionGet ();
540- } else {
541- client ().admin ().indices ().prepareCreate ("test" ).addMapping ("type" , "geo" , "type=geo_shape,tree=quadtree" )
542- .execute ().actionGet ();
543- }
520+ XContentBuilder builder = createRandomMapping ();
521+ client ().admin ().indices ().prepareCreate ("test" ).addMapping ("type" , builder )
522+ .execute ().actionGet ();
544523
545524 XContentBuilder docSource = gcb .toXContent (jsonBuilder ().startObject ().field ("geo" ), null ).endObject ();
546525 client ().prepareIndex ("test" , "type" , "1" ).setSource (docSource ).setRefreshPolicy (IMMEDIATE ).get ();
@@ -696,13 +675,9 @@ public void testQueryRandomGeoCollection() throws Exception {
696675
697676 logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
698677
699- if (randomBoolean ()) {
700- client ().admin ().indices ().prepareCreate ("test" )
701- .addMapping ("type" , "geo" , "type=geo_shape" ).get ();
702- } else {
703- client ().admin ().indices ().prepareCreate ("test" )
704- .addMapping ("type" , "geo" , "type=geo_shape,tree=quadtree" ).get ();
705- }
678+ XContentBuilder builder = createRandomMapping ();
679+ client ().admin ().indices ().prepareCreate ("test" )
680+ .addMapping ("type" , builder ).get ();
706681
707682 XContentBuilder docSource = gcb .toXContent (jsonBuilder ().startObject ().field ("geo" ), null ).endObject ();
708683 client ().prepareIndex ("test" , "type" , "1" ).setSource (docSource ).setRefreshPolicy (IMMEDIATE ).get ();
0 commit comments