@@ -42,6 +42,8 @@ public abstract class AbstractGeoBucketAggregationIntegTest extends GeoModulePlu
4242
4343 protected static final int MAX_PRECISION_FOR_GEO_SHAPES_AGG_TESTING = 4 ;
4444
45+ protected static final int MIN_PRECISION_WITHOUT_BB_AGGS = 2 ;
46+
4547 protected static final int NUM_DOCS = 100 ;
4648
4749 protected static final String GEO_SHAPE_INDEX_NAME = "geoshape_index" ;
@@ -88,14 +90,13 @@ protected void prepareGeoShapeIndexForAggregations(final Random random) throws E
8890 final Geometry geometry = RandomGeoGeometryGenerator .randomGeometry (random );
8991 final GeoShapeDocValue geometryDocValue = GeoShapeDocValue .createGeometryDocValue (geometry );
9092 // make sure that there is 1 shape is intersecting with the bounding box
91- if (!isShapeIntersectingBB ) {
92- isShapeIntersectingBB = geometryDocValue .isIntersectingRectangle (boundingRectangleForGeoShapesAgg );
93- if (!isShapeIntersectingBB && i == NUM_DOCS - 1 ) {
94- continue ;
95- }
93+ isShapeIntersectingBB = geometryDocValue .isIntersectingRectangle (boundingRectangleForGeoShapesAgg );
94+ if (!isShapeIntersectingBB && i == NUM_DOCS - 1 ) {
95+ continue ;
9696 }
97+
9798 i ++;
98- final Set <String > values = generateBucketsForGeometry (geometry , geometryDocValue );
99+ final Set <String > values = generateBucketsForGeometry (geometry , geometryDocValue , isShapeIntersectingBB );
99100 geoshapes .add (indexGeoShape (GEO_SHAPE_INDEX_NAME , geometry ));
100101 for (final String hash : values ) {
101102 expectedDocsCountForGeoShapes .put (hash , expectedDocsCountForGeoShapes .getOrDefault (hash , 0 ) + 1 );
@@ -109,11 +110,14 @@ protected void prepareGeoShapeIndexForAggregations(final Random random) throws E
109110 * Returns a set of buckets for the shape at different precision level. Override this method for different bucket
110111 * aggregations.
111112 *
112- * @param geometry {@link Geometry}
113- * @param geoShapeDocValue {@link GeoShapeDocValue}
113+ * @param geometry {@link Geometry}
114+ * @param geoShapeDocValue {@link GeoShapeDocValue}
115+ * @param intersectingWithBB boolean
114116 * @return A {@link Set} of {@link String} which represents the buckets.
115117 */
116- protected abstract Set <String > generateBucketsForGeometry (final Geometry geometry , final GeoShapeDocValue geoShapeDocValue );
118+ protected abstract Set <String > generateBucketsForGeometry (final Geometry geometry ,
119+ final GeoShapeDocValue geoShapeDocValue ,
120+ final boolean intersectingWithBB );
117121
118122 /**
119123 * Prepares a GeoPoint index for testing the GeoPoint bucket aggregations. Different bucket aggregations can use
0 commit comments