Skip to content

Commit 03d5ac4

Browse files
authored
Merge pull request #2187 from elastic/fix/2.x-georelation
Add relation to geo_shape queries
2 parents b2ad5dd + 3136443 commit 03d5ac4

22 files changed

+95
-45
lines changed

src/Nest/CommonAbstractions/Extensions/Extensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ internal static IEnumerable<T> DistinctBy<T, TKey>(this IEnumerable<T> items, Fu
5858
internal static ConcurrentDictionary<string, object> _enumCache = new ConcurrentDictionary<string, object>();
5959
internal static T? ToEnum<T>(this string str, StringComparison comparison = StringComparison.OrdinalIgnoreCase) where T : struct
6060
{
61+
if (str == null) return null;
62+
6163
var enumType = typeof(T);
6264
var key = $"{enumType.Name}.{str}";
6365
object value;

src/Nest/CommonOptions/Geo/GeoShapeRelation.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public enum GeoShapeRelation
1212
[EnumMember(Value = "disjoint")]
1313
Disjoint,
1414
[EnumMember(Value = "within")]
15-
Within
15+
Within,
16+
[EnumMember(Value = "contains")]
17+
Contains
1618
}
1719
}

src/Nest/QueryDsl/Geo/Shape/Circle/GeoShapeCircleQuery.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ public interface IGeoShapeCircleQuery : IGeoShapeQuery
99
ICircleGeoShape Shape { get; set; }
1010
}
1111

12-
public class GeoShapeCircleQuery : FieldNameQueryBase, IGeoShapeCircleQuery
12+
public class GeoShapeCircleQuery : GeoShapeQueryBase, IGeoShapeCircleQuery
1313
{
1414
protected override bool Conditionless => IsConditionless(this);
1515
public ICircleGeoShape Shape { get; set; }
1616

1717
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoShape = this;
18+
1819
internal static bool IsConditionless(IGeoShapeCircleQuery q) => q.Field.IsConditionless() || q.Shape == null || q.Shape.Coordinates == null;
1920
}
2021

21-
public class GeoShapeCircleQueryDescriptor<T>
22-
: FieldNameQueryDescriptorBase<GeoShapeCircleQueryDescriptor<T>, IGeoShapeCircleQuery, T>
22+
public class GeoShapeCircleQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeCircleQueryDescriptor<T>, IGeoShapeCircleQuery, T>
2324
, IGeoShapeCircleQuery where T : class
2425
{
2526
protected override bool Conditionless => GeoShapeCircleQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/Envelope/GeoShapeEnvelopeQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGeoShapeEnvelopeQuery : IGeoShapeQuery
1010
IEnvelopeGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapeEnvelopeQuery : FieldNameQueryBase, IGeoShapeEnvelopeQuery
13+
public class GeoShapeEnvelopeQuery : GeoShapeQueryBase, IGeoShapeEnvelopeQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IEnvelopeGeoShape Shape { get; set; }
@@ -19,8 +19,8 @@ public class GeoShapeEnvelopeQuery : FieldNameQueryBase, IGeoShapeEnvelopeQuery
1919
internal static bool IsConditionless(IGeoShapeEnvelopeQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
2121

22-
public class GeoShapeEnvelopeQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapeEnvelopeQueryDescriptor<T>, IGeoShapeEnvelopeQuery, T>
22+
public class GeoShapeEnvelopeQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeEnvelopeQueryDescriptor<T>, IGeoShapeEnvelopeQuery, T>
2424
, IGeoShapeEnvelopeQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapeEnvelopeQuery.IsConditionless(this);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
3737
JToken shape;
3838
JToken indexedShape;
3939
IGeoShapeQuery query = null;
40+
4041
if (jo.TryGetValue("shape", out shape))
4142
query = ParseShape(shape, serializer);
4243
else if (jo.TryGetValue("indexed_shape", out indexedShape))
@@ -45,9 +46,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
4546
if (query == null) return null;
4647
var boost = jo["boost"]?.Value<double>();
4748
var name = jo["_name"]?.Value<string>();
49+
var relation = jo["relation"]?.Value<string>().ToEnum<GeoShapeRelation>();
4850
query.Boost = boost;
4951
query.Name = name;
5052
query.Field = field;
53+
query.Relation = relation;
5154
return query;
5255
}
5356

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@
33
namespace Nest
44
{
55
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
6-
[JsonConverter(typeof (CompositeJsonConverter<GeoShapeQueryJsonConverter, FieldNameQueryJsonConverter<GeoShapeCircleQuery>>))]
6+
[JsonConverter(typeof(CompositeJsonConverter<GeoShapeQueryJsonConverter, FieldNameQueryJsonConverter<GeoShapeCircleQuery>>))]
77
public interface IGeoShapeQuery : IFieldNameQuery
88
{
9+
[JsonProperty("relation")]
10+
GeoShapeRelation? Relation { get; set; }
911
}
10-
}
12+
13+
public abstract class GeoShapeQueryBase : FieldNameQueryBase, IGeoShapeQuery
14+
{
15+
public GeoShapeRelation? Relation { get; set; }
16+
}
17+
18+
public abstract class GeoShapeQueryDescriptorBase<TDescriptor, TInterface, T>
19+
: FieldNameQueryDescriptorBase<TDescriptor, TInterface, T>, IGeoShapeQuery
20+
where TDescriptor : FieldNameQueryDescriptorBase<TDescriptor, TInterface, T>, TInterface
21+
where TInterface : class, IGeoShapeQuery
22+
where T : class
23+
{
24+
GeoShapeRelation? IGeoShapeQuery.Relation { get; set; }
25+
26+
public TDescriptor Relation(GeoShapeRelation relation) => Assign(a => a.Relation = relation);
27+
}
28+
}

src/Nest/QueryDsl/Geo/Shape/IndexedShape/GeoIndexedShapeQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ public interface IGeoIndexedShapeQuery : IGeoShapeQuery
1010
IFieldLookup IndexedShape { get; set; }
1111
}
1212

13-
public class GeoIndexedShapeQuery : FieldNameQueryBase, IGeoIndexedShapeQuery
13+
public class GeoIndexedShapeQuery : GeoShapeQueryBase, IGeoIndexedShapeQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IFieldLookup IndexedShape { get; set; }
1717

1818
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoShape = this;
1919

20-
internal static bool IsConditionless(IGeoIndexedShapeQuery q) =>
20+
internal static bool IsConditionless(IGeoIndexedShapeQuery q) =>
2121
q.Field.IsConditionless() || q.IndexedShape == null
2222
|| q.IndexedShape.Id == null | q.IndexedShape.Index == null || q.IndexedShape.Type == null
2323
|| q.IndexedShape.Path == null;
2424
}
2525

26-
public class GeoIndexedShapeQueryDescriptor<T> : FieldNameQueryDescriptorBase<GeoIndexedShapeQueryDescriptor<T>, IGeoIndexedShapeQuery, T>
26+
public class GeoIndexedShapeQueryDescriptor<T> : GeoShapeQueryDescriptorBase<GeoIndexedShapeQueryDescriptor<T>, IGeoIndexedShapeQuery, T>
2727
, IGeoIndexedShapeQuery where T : class
2828
{
2929
protected override bool Conditionless => GeoIndexedShapeQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/LineString/GeoShapeLineStringQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGeoShapeLineStringQuery : IGeoShapeQuery
1010
ILineStringGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapeLineStringQuery : FieldNameQueryBase, IGeoShapeLineStringQuery
13+
public class GeoShapeLineStringQuery : GeoShapeQueryBase, IGeoShapeLineStringQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public ILineStringGeoShape Shape { get; set; }
@@ -19,8 +19,8 @@ public class GeoShapeLineStringQuery : FieldNameQueryBase, IGeoShapeLineStringQu
1919
internal static bool IsConditionless(IGeoShapeLineStringQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
2121

22-
public class GeoShapeLineStringQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapeLineStringQueryDescriptor<T>, IGeoShapeLineStringQuery, T>
22+
public class GeoShapeLineStringQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeLineStringQueryDescriptor<T>, IGeoShapeLineStringQuery, T>
2424
, IGeoShapeLineStringQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapeLineStringQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/MultiLineString/GeoShapeMultiLineStringQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGeoShapeMultiLineStringQuery : IGeoShapeQuery
1010
IMultiLineStringGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapeMultiLineStringQuery : FieldNameQueryBase, IGeoShapeMultiLineStringQuery
13+
public class GeoShapeMultiLineStringQuery : GeoShapeQueryBase, IGeoShapeMultiLineStringQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IMultiLineStringGeoShape Shape { get; set; }
@@ -19,8 +19,8 @@ public class GeoShapeMultiLineStringQuery : FieldNameQueryBase, IGeoShapeMultiLi
1919
internal static bool IsConditionless(IGeoShapeMultiLineStringQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
2121

22-
public class GeoShapeMultiLineStringQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapeMultiLineStringQueryDescriptor<T>, IGeoShapeMultiLineStringQuery, T>
22+
public class GeoShapeMultiLineStringQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeMultiLineStringQueryDescriptor<T>, IGeoShapeMultiLineStringQuery, T>
2424
, IGeoShapeMultiLineStringQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapeMultiLineStringQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/MultiPoint/GeoShapeMultiPointQuery.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ public interface IGeoShapeMultiPointQuery : IGeoShapeQuery
1010
IMultiPointGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapeMultiPointQuery : FieldNameQueryBase, IGeoShapeMultiPointQuery
13+
public class GeoShapeMultiPointQuery : GeoShapeQueryBase, IGeoShapeMultiPointQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IMultiPointGeoShape Shape { get; set; }
1717

1818
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoShape = this;
1919
internal static bool IsConditionless(IGeoShapeMultiPointQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
21-
22-
public class GeoShapeMultiPointQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapeMultiPointQueryDescriptor<T>, IGeoShapeMultiPointQuery, T>
21+
22+
public class GeoShapeMultiPointQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeMultiPointQueryDescriptor<T>, IGeoShapeMultiPointQuery, T>
2424
, IGeoShapeMultiPointQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapeMultiPointQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/MultiPolygon/GeoShapeMultiPolygonQuery.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGeoShapeMultiPolygonQuery : IGeoShapeQuery
1010
IMultiPolygonGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapeMultiPolygonQuery : FieldNameQueryBase, IGeoShapeMultiPolygonQuery
13+
public class GeoShapeMultiPolygonQuery : GeoShapeQueryBase, IGeoShapeMultiPolygonQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IMultiPolygonGeoShape Shape { get; set; }
@@ -19,14 +19,16 @@ public class GeoShapeMultiPolygonQuery : FieldNameQueryBase, IGeoShapeMultiPolyg
1919
internal static bool IsConditionless(IGeoShapeMultiPolygonQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
2121

22-
public class GeoShapeMultiPolygonQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapeMultiPolygonQueryDescriptor<T>, IGeoShapeMultiPolygonQuery, T>
22+
public class GeoShapeMultiPolygonQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapeMultiPolygonQueryDescriptor<T>, IGeoShapeMultiPolygonQuery, T>
2424
, IGeoShapeMultiPolygonQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapeMultiPolygonQuery.IsConditionless(this);
2727
IMultiPolygonGeoShape IGeoShapeMultiPolygonQuery.Shape { get; set; }
2828

2929
public GeoShapeMultiPolygonQueryDescriptor<T> Coordinates(IEnumerable<IEnumerable<IEnumerable<GeoCoordinate>>> coordinates) =>
3030
Assign(a => a.Shape = new MultiPolygonGeoShape { Coordinates = coordinates });
31+
32+
3133
}
3234
}

src/Nest/QueryDsl/Geo/Shape/Point/GeoShapePointQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface IGeoShapePointQuery : IGeoShapeQuery
99
IPointGeoShape Shape { get; set; }
1010
}
1111

12-
public class GeoShapePointQuery : FieldNameQueryBase, IGeoShapePointQuery
12+
public class GeoShapePointQuery : GeoShapeQueryBase, IGeoShapePointQuery
1313
{
1414
protected override bool Conditionless => IsConditionless(this);
1515
public IPointGeoShape Shape { get; set; }
@@ -18,8 +18,8 @@ public class GeoShapePointQuery : FieldNameQueryBase, IGeoShapePointQuery
1818
internal static bool IsConditionless(IGeoShapePointQuery q) => q.Field.IsConditionless() || q.Shape?.Coordinates == null;
1919
}
2020

21-
public class GeoShapePointQueryDescriptor<T>
22-
: FieldNameQueryDescriptorBase<GeoShapePointQueryDescriptor<T>, IGeoShapePointQuery, T>
21+
public class GeoShapePointQueryDescriptor<T>
22+
: GeoShapeQueryDescriptorBase<GeoShapePointQueryDescriptor<T>, IGeoShapePointQuery, T>
2323
, IGeoShapePointQuery where T : class
2424
{
2525
protected override bool Conditionless => GeoShapePointQuery.IsConditionless(this);

src/Nest/QueryDsl/Geo/Shape/Polygon/GeoShapePolygonQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGeoShapePolygonQuery : IGeoShapeQuery
1010
IPolygonGeoShape Shape { get; set; }
1111
}
1212

13-
public class GeoShapePolygonQuery : FieldNameQueryBase, IGeoShapePolygonQuery
13+
public class GeoShapePolygonQuery : GeoShapeQueryBase, IGeoShapePolygonQuery
1414
{
1515
protected override bool Conditionless => IsConditionless(this);
1616
public IPolygonGeoShape Shape { get; set; }
@@ -19,8 +19,8 @@ public class GeoShapePolygonQuery : FieldNameQueryBase, IGeoShapePolygonQuery
1919
internal static bool IsConditionless(IGeoShapePolygonQuery q) => q.Field.IsConditionless() || q.Shape == null || !q.Shape.Coordinates.HasAny();
2020
}
2121

22-
public class GeoShapePolygonQueryDescriptor<T>
23-
: FieldNameQueryDescriptorBase<GeoShapePolygonQueryDescriptor<T>, IGeoShapePolygonQuery, T>
22+
public class GeoShapePolygonQueryDescriptor<T>
23+
: GeoShapeQueryDescriptorBase<GeoShapePolygonQueryDescriptor<T>, IGeoShapePolygonQuery, T>
2424
, IGeoShapePolygonQuery where T : class
2525
{
2626
protected override bool Conditionless => GeoShapePolygonQuery.IsConditionless(this);

src/Tests/QueryDsl/Geo/Shape/Circle/GeoShapeCircleUsageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public GeoShapeCircleUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i
2323
Name = "named_query",
2424
Boost = 1.1,
2525
Field = Field<Project>(p=>p.Location),
26-
Shape = new CircleGeoShape(this._coordinates) { Radius = "100m" }
26+
Shape = new CircleGeoShape(this._coordinates) { Radius = "100m" },
27+
Relation = GeoShapeRelation.Intersects
2728
};
2829

2930
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -33,6 +34,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3334
.Field(p=>p.Location)
3435
.Coordinates(this._coordinates)
3536
.Radius("100m")
37+
.Relation(GeoShapeRelation.Intersects)
3638
);
3739

3840
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeCircleQuery>(a => a.GeoShape as IGeoShapeCircleQuery)

src/Tests/QueryDsl/Geo/Shape/Envelope/GeoEnvelopeUsageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public GeoEnvelopeUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u
2727
Name = "named_query",
2828
Boost = 1.1,
2929
Field = Field<Project>(p=>p.Location),
30-
Shape = new EnvelopeGeoShape(this._coordinates)
30+
Shape = new EnvelopeGeoShape(this._coordinates),
31+
Relation = GeoShapeRelation.Intersects
3132
};
3233

3334
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -36,6 +37,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3637
.Boost(1.1)
3738
.Field(p=>p.Location)
3839
.Coordinates(this._coordinates)
40+
.Relation(GeoShapeRelation.Intersects)
3941
);
4042

4143
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeEnvelopeQuery>(a => a.GeoShape as IGeoShapeEnvelopeQuery)

src/Tests/QueryDsl/Geo/Shape/IndexedShape/GeoIndexedShapeUsageTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ public GeoIndexedShapeUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(
1717
{
1818
_name="named_query",
1919
boost = 1.1,
20-
indexed_shape = new
20+
indexed_shape = new
2121
{
2222
id = 2,
2323
type = "project",
2424
index = "project",
2525
path = "location"
26-
}
26+
},
27+
relation = "intersects"
2728
}
2829
}
2930
};
@@ -38,8 +39,9 @@ public GeoIndexedShapeUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(
3839
Id = 2,
3940
Index = Index<Project>(),
4041
Type = Type<Project>(),
41-
Path = Field<Project>(p=>p.Location)
42-
}
42+
Path = Field<Project>(p=>p.Location),
43+
},
44+
Relation = GeoShapeRelation.Intersects
4345
};
4446

4547
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -51,6 +53,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
5153
.Id(2)
5254
.Path(pp=>pp.Location)
5355
)
56+
.Relation(GeoShapeRelation.Intersects)
5457
);
5558

5659
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoIndexedShapeQuery>(a => a.GeoShape as IGeoIndexedShapeQuery)

src/Tests/QueryDsl/Geo/Shape/LineString/GeoLineStringUsageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public GeoLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i,
2727
Name = "named_query",
2828
Boost = 1.1,
2929
Field = Field<Project>(p=>p.Location),
30-
Shape = new LineStringGeoShape(this._coordinates)
30+
Shape = new LineStringGeoShape(this._coordinates),
31+
Relation = GeoShapeRelation.Intersects
3132
};
3233

3334
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -36,6 +37,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3637
.Boost(1.1)
3738
.Field(p=>p.Location)
3839
.Coordinates(this._coordinates)
40+
.Relation(GeoShapeRelation.Intersects)
3941
);
4042

4143
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeLineStringQuery>(a => a.GeoShape as IGeoShapeLineStringQuery)

src/Tests/QueryDsl/Geo/Shape/MultiLineString/GeoMultiLineStringUsageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public GeoMultiLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba
2828
Name = "named_query",
2929
Boost = 1.1,
3030
Field = Field<Project>(p=>p.Location),
31-
Shape = new MultiLineStringGeoShape(this._coordinates)
31+
Shape = new MultiLineStringGeoShape(this._coordinates),
32+
Relation = GeoShapeRelation.Intersects
3233
};
3334

3435
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -37,6 +38,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3738
.Boost(1.1)
3839
.Field(p=>p.Location)
3940
.Coordinates(this._coordinates)
41+
.Relation(GeoShapeRelation.Intersects)
4042
);
4143

4244
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeMultiLineStringQuery>(a => a.GeoShape as IGeoShapeMultiLineStringQuery)

src/Tests/QueryDsl/Geo/Shape/MultiPoint/GeoMultiPointUsageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public GeoMultiPointUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i,
2727
Name = "named_query",
2828
Boost = 1.1,
2929
Field = Field<Project>(p=>p.Location),
30-
Shape = new MultiPointGeoShape(this._coordinates)
30+
Shape = new MultiPointGeoShape(this._coordinates),
31+
Relation = GeoShapeRelation.Intersects
3132
};
3233

3334
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -36,6 +37,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3637
.Boost(1.1)
3738
.Field(p=>p.Location)
3839
.Coordinates(this._coordinates)
40+
.Relation(GeoShapeRelation.Intersects)
3941
);
4042

4143
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeMultiPointQuery>(a => a.GeoShape as IGeoShapeMultiPointQuery)

0 commit comments

Comments
 (0)