@@ -206,23 +206,8 @@ public void testShapeFetchingPath() throws Exception {
206
206
}
207
207
208
208
public void testRandomGeoCollectionQuery () throws Exception {
209
- boolean usePrefixTrees = randomBoolean ();
210
209
// 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 ());
226
211
org .apache .lucene .geo .Polygon randomPoly = GeoTestUtil .nextPolygon ();
227
212
228
213
assumeTrue ("Skipping the check for the polygon with a degenerated dimension" ,
@@ -234,10 +219,9 @@ public void testRandomGeoCollectionQuery() throws Exception {
234
219
}
235
220
gcb .shape (new PolygonBuilder (cb ));
236
221
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 ());
239
223
240
- XContentBuilder mapping = createPrefixTreeMapping ( usePrefixTrees ? "geohash" : "quadtree" );
224
+ XContentBuilder mapping = createRandomMapping ( );
241
225
Settings settings = Settings .builder ().put ("index.number_of_shards" , 1 ).build ();
242
226
client ().admin ().indices ().prepareCreate ("test" ).addMapping ("_doc" ,mapping ).setSettings (settings ).get ();
243
227
ensureGreen ();
@@ -321,8 +305,7 @@ public void testEnvelopeSpanningDateline() throws Exception {
321
305
}
322
306
323
307
public void testGeometryCollectionRelations () throws Exception {
324
- XContentBuilder mapping = createPrefixTreeMapping (LegacyGeoShapeFieldMapper .DeprecatedParameters .PrefixTrees .GEOHASH );
325
-
308
+ XContentBuilder mapping = createDefaultMapping ();
326
309
createIndex ("test" , Settings .builder ().put ("index.number_of_shards" , 1 ).build (), "doc" , mapping );
327
310
328
311
EnvelopeBuilder envelopeBuilder = new EnvelopeBuilder (new Coordinate (-10 , 10 ), new Coordinate (10 , -10 ));
@@ -441,13 +424,13 @@ public void testIndexedShapeReferenceSourceDisabled() throws Exception {
441
424
442
425
public void testReusableBuilder () throws IOException {
443
426
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 ()));
447
430
assertUnmodified (polygon );
448
431
449
432
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 ());
451
434
assertUnmodified (linestring );
452
435
}
453
436
@@ -534,13 +517,9 @@ public void testExistsQuery() throws Exception {
534
517
GeometryCollectionBuilder gcb = RandomShapeGenerator .createGeometryCollection (random ());
535
518
logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
536
519
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 ();
544
523
545
524
XContentBuilder docSource = gcb .toXContent (jsonBuilder ().startObject ().field ("geo" ), null ).endObject ();
546
525
client ().prepareIndex ("test" , "type" , "1" ).setSource (docSource ).setRefreshPolicy (IMMEDIATE ).get ();
@@ -696,13 +675,9 @@ public void testQueryRandomGeoCollection() throws Exception {
696
675
697
676
logger .info ("Created Random GeometryCollection containing {} shapes" , gcb .numShapes ());
698
677
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 ();
706
681
707
682
XContentBuilder docSource = gcb .toXContent (jsonBuilder ().startObject ().field ("geo" ), null ).endObject ();
708
683
client ().prepareIndex ("test" , "type" , "1" ).setSource (docSource ).setRefreshPolicy (IMMEDIATE ).get ();
0 commit comments