Skip to content

Commit 9149158

Browse files
committed
Fix #1002: GeoBoundingBox filter passing lat,lon points in the wrong order
1 parent 337c5ba commit 9149158

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Diff for: src/Nest/DSL/Filter/FilterDescriptor.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ public FilterContainer GeoBoundingBox(Expression<Func<T, object>> fieldDescripto
165165
topLeftY.ThrowIfNull("topLeftY");
166166
bottomRightX.ThrowIfNull("bottomRightX");
167167
bottomRightY.ThrowIfNull("bottomRightY");
168-
var geoHashTopLeft = "{0}, {1}".F(topLeftX.ToString(c), topLeftY.ToString(c));
169-
var geoHashBottomRight = "{0}, {1}".F(bottomRightX.ToString(c), bottomRightY.ToString(c));
168+
var geoHashTopLeft = "{0}, {1}".F(topLeftY.ToString(c), topLeftX.ToString(c));
169+
var geoHashBottomRight = "{0}, {1}".F(bottomRightY.ToString(c), bottomRightX.ToString(c));
170170
return this.GeoBoundingBox(fieldDescriptor, geoHashTopLeft, geoHashBottomRight, type);
171171
}
172172
/// <summary>
@@ -179,8 +179,8 @@ public FilterContainer GeoBoundingBox(string fieldName, double topLeftX, double
179179
topLeftY.ThrowIfNull("topLeftY");
180180
bottomRightX.ThrowIfNull("bottomRightX");
181181
bottomRightY.ThrowIfNull("bottomRightY");
182-
var geoHashTopLeft = "{0}, {1}".F(topLeftX.ToString(c), topLeftY.ToString(c));
183-
var geoHashBottomRight = "{0}, {1}".F(bottomRightX.ToString(c), bottomRightY.ToString(c));
182+
var geoHashTopLeft = "{0}, {1}".F(topLeftY.ToString(c), topLeftX.ToString(c));
183+
var geoHashBottomRight = "{0}, {1}".F(bottomRightY.ToString(c), bottomRightX.ToString(c));
184184
return this.GeoBoundingBox(fieldName, geoHashTopLeft, geoHashBottomRight, type);
185185
}
186186
/// <summary>

Diff for: src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBox/Array.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"filter": {
33
"geo_bounding_box": {
44
"origin": {
5-
"top_left": [0.1, 0.2],
6-
"bottom_right": [0.3, 0.4]
5+
"top_left": [0.2, 0.1],
6+
"bottom_right": [0.4, 0.3]
77
},
88
"type": "memory",
99
"_cache": true,

Diff for: src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBoxFilterTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public void GeoBoundingBox_Deserializes(string cacheName, string cacheKey, bool
1818

1919
geoBoundingBox.Field.Should().Be("origin");
2020
geoBoundingBox.GeoExecution.Should().Be(GeoExecution.Memory);
21-
geoBoundingBox.TopLeft.Should().Be("0.1, 0.2");
22-
geoBoundingBox.BottomRight.Should().Be("0.3, 0.4");
21+
geoBoundingBox.TopLeft.Should().Be("0.2, 0.1");
22+
geoBoundingBox.BottomRight.Should().Be("0.4, 0.3");
2323
}
2424

2525
[Test]
@@ -29,8 +29,8 @@ public void GeoBoundingBox_Array_Deserializes()
2929
var filter = this.ParseSearchDescriptorFromFile(f => f.GeoBoundingBox, MethodBase.GetCurrentMethod(), @"GeoBoundingBox\Array");
3030
filter.Field.Should().Be("origin");
3131
filter.GeoExecution.Should().Be(GeoExecution.Memory);
32-
filter.TopLeft.Should().Be("0.1, 0.2");
33-
filter.BottomRight.Should().Be("0.3, 0.4");
32+
filter.TopLeft.Should().Be("0.2, 0.1");
33+
filter.BottomRight.Should().Be("0.4, 0.3");
3434
}
3535

3636
[Test]

Diff for: src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoBoundingBoxFilterJson.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public void GeoBoundingBoxFilter()
2121
filter : {
2222
geo_bounding_box: {
2323
origin : {
24-
top_left: ""40.73, -74.1"",
25-
bottom_right: ""40.717, -73.99""
24+
top_left: ""-74.1, 40.73"",
25+
bottom_right: ""-73.99, 40.717""
2626
}
2727
}
2828
}
@@ -52,8 +52,8 @@ public void GeoBoundingBoxFilterCacheNamed()
5252
filter : {
5353
geo_bounding_box: {
5454
origin : {
55-
top_left: ""40.73, -74.1"",
56-
bottom_right: ""40.717, -73.99""
55+
top_left: ""-74.1, 40.73"",
56+
bottom_right: ""-73.99, 40.717""
5757
},
5858
type: ""indexed"",
5959
_cache : true,

0 commit comments

Comments
 (0)