Skip to content

Commit 4b980eb

Browse files
committed
Remove IgnoreUnmapped on GeometryCollection
This commit removes IgnoreUnmapped on GeometryCollection. The property was included on the cherry-pick in previous commit 9bdd82b but should not have been. Explicitly call IgnoreUnmapped(true) on fluent GeoShapeEnvelopeQueryDescriptor as default parameter value is false
1 parent 9bdd82b commit 4b980eb

File tree

3 files changed

+19
-39
lines changed

3 files changed

+19
-39
lines changed

src/Nest/QueryDsl/Geo/Shape/GeoShapeQueryJsonConverter.cs

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
8484
var relation = jo["relation"]?.Value<string>().ToEnum<GeoShapeRelation>();
8585
query.Boost = boost;
8686
query.Name = name;
87-
query.IgnoreUnmapped = ignoreUnmapped;
8887
query.Field = field;
8988
query.Relation = relation;
89+
query.IgnoreUnmapped = ignoreUnmapped;
9090
return query;
9191
}
9292

@@ -98,49 +98,24 @@ private static IGeoShapeQuery ParseShapeQuery(JToken shape, JsonSerializer seria
9898
var type = shape["type"];
9999
var typeName = type?.Value<string>();
100100
var geometry = GeoShapeConverter.ReadJToken(shape, serializer);
101-
102101
switch (typeName)
103102
{
104103
case "circle":
105-
return new GeoShapeCircleQuery
106-
{
107-
Shape = geometry as ICircleGeoShape
108-
};
104+
return new GeoShapeCircleQuery { Shape = geometry as ICircleGeoShape };
109105
case "envelope":
110-
return new GeoShapeEnvelopeQuery
111-
{
112-
Shape = geometry as IEnvelopeGeoShape
113-
};
106+
return new GeoShapeEnvelopeQuery { Shape = geometry as IEnvelopeGeoShape };
114107
case "linestring":
115-
return new GeoShapeLineStringQuery
116-
{
117-
Shape = geometry as ILineStringGeoShape
118-
};
108+
return new GeoShapeLineStringQuery { Shape = geometry as ILineStringGeoShape };
119109
case "multilinestring":
120-
return new GeoShapeMultiLineStringQuery
121-
{
122-
Shape = geometry as IMultiLineStringGeoShape
123-
};
110+
return new GeoShapeMultiLineStringQuery { Shape = geometry as IMultiLineStringGeoShape };
124111
case "point":
125-
return new GeoShapePointQuery
126-
{
127-
Shape = geometry as IPointGeoShape
128-
};
112+
return new GeoShapePointQuery { Shape = geometry as IPointGeoShape };
129113
case "multipoint":
130-
return new GeoShapeMultiPointQuery
131-
{
132-
Shape = geometry as IMultiPointGeoShape
133-
};
114+
return new GeoShapeMultiPointQuery { Shape = geometry as IMultiPointGeoShape };
134115
case "polygon":
135-
return new GeoShapePolygonQuery
136-
{
137-
Shape = geometry as IPolygonGeoShape
138-
};
116+
return new GeoShapePolygonQuery { Shape = geometry as IPolygonGeoShape };
139117
case "multipolygon":
140-
return new GeoShapeMultiPolygonQuery
141-
{
142-
Shape = geometry as IMultiPolygonGeoShape
143-
};
118+
return new GeoShapeMultiPolygonQuery { Shape = geometry as IMultiPolygonGeoShape };
144119
case "geometrycollection":
145120
return new GeoShapeGeometryCollectionQuery { Shape = geometry as IGeometryCollection };
146121
default:

src/Nest/QueryDsl/Geo/Shape/GeometryCollection/GeometryCollection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public interface IGeometryCollection
2222
IEnumerable<IGeoShape> Geometries { get; set; }
2323
}
2424

25-
// TODO: IGeometryCollection should implement IGeoShape
2625
/// <inheritdoc cref="IGeometryCollection"/>
2726
public class GeometryCollection : IGeometryCollection, IGeoShape
2827
{
@@ -32,9 +31,6 @@ public class GeometryCollection : IGeometryCollection, IGeoShape
3231
/// <inheritdoc />
3332
string IGeoShape.Type => this.Type;
3433

35-
/// <inheritdoc />
36-
public bool? IgnoreUnmapped { get; set; }
37-
3834
/// <inheritdoc />
3935
public IEnumerable<IGeoShape> Geometries { get; set; }
4036
}

src/Tests/QueryDsl/Geo/GeoShapeQueryUsageTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ protected override LazyResponses ClientUsage() => Calls(
7777
{
7878
geo_shape = new
7979
{
80+
_name="named_query",
81+
boost = 1.1,
82+
ignore_unmapped = true,
8083
envelope = new
8184
{
8285
relation = "intersects",
@@ -99,18 +102,24 @@ protected override LazyResponses ClientUsage() => Calls(
99102
{
100103
Query = new GeoShapeEnvelopeQuery
101104
{
105+
Name = "named_query",
106+
Boost = 1.1,
102107
Field = Infer.Field<Framework.MockData.Shape>(p => p.Envelope),
103108
Shape = new EnvelopeGeoShape(this._coordinates),
104-
Relation = GeoShapeRelation.Intersects
109+
Relation = GeoShapeRelation.Intersects,
110+
IgnoreUnmapped = true
105111
}
106112
};
107113

108114
protected override Func<SearchDescriptor<Framework.MockData.Shape>, ISearchRequest> Fluent => s => s
109115
.Query(q => q
110116
.GeoShapeEnvelope(c => c
117+
.Name("named_query")
118+
.Boost(1.1)
111119
.Field(p => p.Envelope)
112120
.Coordinates(this._coordinates)
113121
.Relation(GeoShapeRelation.Intersects)
122+
.IgnoreUnmapped(true)
114123
)
115124
);
116125

0 commit comments

Comments
 (0)