Skip to content

Commit daffcf1

Browse files
authored
reset queryGeometry in ShapeQueryTests (#45974)
1 parent d67a3c9 commit daffcf1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/search/ShapeQueryTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public void setUp() throws Exception {
6262

6363
// index random shapes
6464
numDocs = randomIntBetween(25, 50);
65+
// reset query geometry to make sure we pick one from the indexed shapes
66+
queryGeometry = null;
6567
Geometry geometry;
6668
for (int i = 0; i < numDocs; ++i) {
6769
geometry = ShapeTestUtils.randomGeometry(false);
@@ -77,6 +79,10 @@ public void setUp() throws Exception {
7779
client().prepareIndex(IGNORE_MALFORMED_INDEX, FIELD_TYPE).setRefreshPolicy(IMMEDIATE).setSource(geoJson).get();
7880
} catch (Exception e) {
7981
// sometimes GeoTestUtil will create invalid geometry; catch and continue:
82+
if (queryGeometry == geometry) {
83+
// reset query geometry as it didn't get indexed
84+
queryGeometry = null;
85+
}
8086
--i;
8187
continue;
8288
}
@@ -227,7 +233,6 @@ public void testExistsQuery() {
227233
assertHitCount(result, numDocs);
228234
}
229235

230-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/45628")
231236
public void testFieldAlias() {
232237
SearchResponse response = client().prepareSearch(INDEX)
233238
.setQuery(new ShapeQueryBuilder("alias", queryGeometry).relation(ShapeRelation.INTERSECTS))

0 commit comments

Comments
 (0)