@@ -196,23 +196,9 @@ public void testShapeFetchingPath() throws Exception {
196196 }
197197
198198 public void testRandomGeoCollectionQuery () throws Exception {
199- boolean usePrefixTrees = randomBoolean ();
200199 // Create a random geometry collection to index.
201- GeometryCollectionBuilder gcb ;
202- if (usePrefixTrees ) {
203- gcb = RandomShapeGenerator .createGeometryCollection (random ());
204- } else {
205- // vector strategy does not yet support multipoint queries
206- gcb = new GeometryCollectionBuilder ();
207- int numShapes = RandomNumbers .randomIntBetween (random (), 1 , 4 );
208- for (int i = 0 ; i < numShapes ; ++i ) {
209- ShapeBuilder shape ;
210- do {
211- shape = RandomShapeGenerator .createShape (random ());
212- } while (shape instanceof MultiPointBuilder );
213- gcb .shape (shape );
214- }
215- }
200+ GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());;
201+
216202 org .apache .lucene .geo .Polygon randomPoly = GeoTestUtil .nextPolygon ();
217203
218204 assumeTrue ("Skipping the check for the polygon with a degenerated dimension" ,
@@ -224,10 +210,9 @@ public void testRandomGeoCollectionQuery() throws Exception {
224210 }
225211 gcb .shape (new PolygonBuilder (cb ));
226212
227- logger .info ("Created Random GeometryCollection containing {} shapes using {} tree" , gcb .numShapes (),
228- usePrefixTrees ? "geohash" : "quadtree" );
213+ logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
229214
230- XContentBuilder mapping = createPrefixTreeMapping ( usePrefixTrees ? "geohash" : "quadtree" );
215+ XContentBuilder mapping = createRandomMapping ( );
231216 Settings settings = Settings .builder ().put ("index.number_of_shards" , 1 ).build ();
232217 client ().admin ().indices ().prepareCreate ("test" ).setMapping (mapping ).setSettings (settings ).get ();
233218 ensureGreen ();
@@ -457,11 +442,8 @@ public void testPointQuery() throws Exception {
457442 PointBuilder pb = new PointBuilder (pt [0 ], pt [1 ]);
458443 gcb .shape (pb );
459444
460- // don't use random as permits quadtree
461- String mapping = Strings .toString (
462- randomBoolean () ?
463- createDefaultMapping () :
464- createPrefixTreeMapping (LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .QUADTREE ));
445+ // create mapping
446+ String mapping = Strings .toString (createRandomMapping ());
465447 client ().admin ().indices ().prepareCreate ("test" ).setMapping (mapping ).get ();
466448 ensureGreen ();
467449
@@ -527,10 +509,8 @@ public void testExistsQuery() throws Exception {
527509 GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());
528510 logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
529511
530- String mapping = Strings .toString (
531- randomBoolean () ?
532- createDefaultMapping () :
533- createPrefixTreeMapping (LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .QUADTREE ));
512+ String mapping = Strings .toString (createRandomMapping ());
513+
534514 client ().admin ().indices ().prepareCreate ("test" ).setMapping (mapping ).get ();
535515 ensureGreen ();
536516
@@ -677,8 +657,7 @@ public void testFieldAlias() throws IOException {
677657
678658 public void testQueryRandomGeoCollection () throws Exception {
679659 // Create a random geometry collection.
680- String mapping = Strings .toString (randomBoolean () ? createDefaultMapping () : createPrefixTreeMapping (
681- LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .QUADTREE ));
660+ String mapping = Strings .toString (createRandomMapping ());
682661 GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());
683662 org .apache .lucene .geo .Polygon randomPoly = GeoTestUtil .nextPolygon ();
684663 CoordinatesBuilder cb = new CoordinatesBuilder ();
@@ -708,8 +687,7 @@ public void testQueryRandomGeoCollection() throws Exception {
708687 }
709688
710689 public void testShapeFilterWithDefinedGeoCollection () throws Exception {
711- String mapping = Strings .toString (
712- createPrefixTreeMapping (LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .QUADTREE ));
690+ String mapping = Strings .toString (createRandomMapping ());
713691 client ().admin ().indices ().prepareCreate ("test" ).setMapping (mapping ).get ();
714692 ensureGreen ();
715693
0 commit comments