Skip to content

Commit 7c4996f

Browse files
committed
fix obsolete warning from forward port of #3770
1 parent 0fca6d0 commit 7c4996f

File tree

4 files changed

+7
-175
lines changed

4 files changed

+7
-175
lines changed

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
public class GeoShapeAttribute : ElasticsearchDocValuesPropertyAttributeBase, IGeoShapeProperty
55
{
66
public GeoShapeAttribute() : base(FieldType.GeoShape) { }
7-
8-
/// <inheritdoc cref="IGeoShapeProperty.DistanceErrorPercentage" />
9-
public double DistanceErrorPercentage
10-
{
11-
get => (Self.Precision != null) | (Self.TreeLevels != null)
12-
? Self.DistanceErrorPercentage.GetValueOrDefault(0)
13-
: Self.DistanceErrorPercentage.GetValueOrDefault(0.025);
14-
set => Self.DistanceErrorPercentage = value;
15-
}
7+
8+
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
9+
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
10+
GeoOrientation? IGeoShapeProperty.Orientation { get; set; }
11+
private IGeoShapeProperty Self => this;
12+
GeoStrategy? IGeoShapeProperty.Strategy { get; set; }
13+
bool? IGeoShapeProperty.Coerce { get; set; }
1614

1715
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed" />
1816
public bool IgnoreMalformed
@@ -35,53 +33,19 @@ public GeoOrientation Orientation
3533
set => Self.Orientation = value;
3634
}
3735

38-
/// <inheritdoc cref="IGeoShapeProperty.PointsOnly" />
39-
public bool PointsOnly
40-
{
41-
get => Self.PointsOnly.GetValueOrDefault(false);
42-
set => Self.PointsOnly = value;
43-
}
44-
4536
/// <inheritdoc cref="IGeoShapeProperty.Strategy" />
4637
public GeoStrategy Strategy
4738
{
4839
get => Self.Strategy.GetValueOrDefault(GeoStrategy.Recursive);
4940
set => Self.Strategy = value;
5041
}
5142

52-
/// <inheritdoc cref="IGeoShapeProperty.Tree" />
53-
public GeoTree Tree
54-
{
55-
get => Self.Tree.GetValueOrDefault(GeoTree.Geohash);
56-
set => Self.Tree = value;
57-
}
58-
59-
/// <inheritdoc cref="IGeoShapeProperty.TreeLevels" />
60-
public int TreeLevels
61-
{
62-
get => Self.TreeLevels.GetValueOrDefault(50);
63-
set => Self.TreeLevels = value;
64-
}
65-
6643
/// <inheritdoc cref="IGeoShapeProperty.Coerce" />
6744
public bool Coerce
6845
{
6946
get => Self.Coerce.GetValueOrDefault(true);
7047
set => Self.Coerce = value;
7148
}
7249

73-
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
74-
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
75-
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
76-
GeoOrientation? IGeoShapeProperty.Orientation { get; set; }
77-
bool? IGeoShapeProperty.PointsOnly { get; set; }
78-
Distance IGeoShapeProperty.Precision { get; set; }
79-
private IGeoShapeProperty Self => this;
80-
GeoStrategy? IGeoShapeProperty.Strategy { get; set; }
81-
82-
GeoTree? IGeoShapeProperty.Tree { get; set; }
83-
int? IGeoShapeProperty.TreeLevels { get; set; }
84-
85-
bool? IGeoShapeProperty.Coerce { get; set; }
8650
}
8751
}

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@ namespace Nest
1111
[InterfaceDataContract]
1212
public interface IGeoShapeProperty : IDocValuesProperty
1313
{
14-
/// <summary>
15-
/// Used as a hint to the Prefix<see cref="Tree" /> about how precise it should be.
16-
/// Defaults to 0.025 (2.5%) with 0.5 as the maximum supported value.
17-
/// </summary>
18-
/// <remarks>
19-
/// NOTE: This value will default to 0 if a <see cref="Precision" /> or <see cref="TreeLevels" /> definition
20-
/// is explicitly defined. This guarantees spatial precision at the level defined in the mapping.
21-
/// This can lead to significant memory usage for high resolution shapes with low error
22-
/// (e.g. large shapes at 1m with &lt; 0.001 error).
23-
/// To improve indexing performance (at the cost of query accuracy) explicitly define <see cref="TreeLevels" /> or
24-
/// <see cref="Precision" /> along with a reasonable <see cref="DistanceErrorPercentage" />,
25-
/// noting that large shapes will have greater false positives.
26-
/// </remarks>
27-
[DataMember(Name ="distance_error_pct")]
28-
[Obsolete("Removed in Elasticsearch 6.6")]
29-
double? DistanceErrorPercentage { get; set; }
30-
3114
/// <summary>
3215
/// If <c>true</c>, malformed geojson shapes are ignored. If false (default),
3316
/// malformed geojson shapes throw an exception and reject the whole document.
@@ -57,27 +40,6 @@ public interface IGeoShapeProperty : IDocValuesProperty
5740
[DataMember(Name ="orientation")]
5841
GeoOrientation? Orientation { get; set; }
5942

60-
/// <summary>
61-
/// Configures the geo_shape field type for point shapes only. Defaults to <c>false</c>.
62-
/// This optimizes index and search performance
63-
/// for the geohash and quadtree when it is known that only points will be indexed.
64-
/// At present geo_shape queries can not be executed on geo_point field types.
65-
/// This option bridges the gap by improving point performance on a geo_shape field
66-
/// so that geo_shape queries are optimal on a point only field.
67-
/// </summary>
68-
[DataMember(Name ="points_only")]
69-
[Obsolete("Removed in Elasticsearch 6.6")]
70-
bool? PointsOnly { get; set; }
71-
72-
/// <summary>
73-
/// Used instead of <see cref="TreeLevels" /> to set an appropriate value for the <see cref="TreeLevels" />
74-
/// parameter. The value specifies the desired precision and Elasticsearch will calculate
75-
/// the best tree_levels value to honor this precision.
76-
/// </summary>
77-
[DataMember(Name ="precision")]
78-
[Obsolete("Removed in Elasticsearch 6.6")]
79-
Distance Precision { get; set; }
80-
8143
/// <summary>
8244
/// Defines the approach for how to represent shapes at indexing and search time.
8345
/// It also influences the capabilities available so it is recommended to let
@@ -86,25 +48,6 @@ public interface IGeoShapeProperty : IDocValuesProperty
8648
[DataMember(Name ="strategy")]
8749
GeoStrategy? Strategy { get; set; }
8850

89-
/// <summary>
90-
/// Name of the PrefixTree implementation to be used.
91-
/// Defaults to <see cref="GeoTree.Geohash" />
92-
/// </summary>
93-
[DataMember(Name ="tree")]
94-
[Obsolete("Removed in Elasticsearch 6.6")]
95-
GeoTree? Tree { get; set; }
96-
97-
/// <summary>
98-
/// Maximum number of layers to be used by the Prefix<see cref="Tree" />. This can be used to control the
99-
/// precision of shape representations and therefore how many terms are indexed.
100-
/// Defaults to the default value of the chosen Prefix<see cref="Tree" /> implementation. Since this parameter requires a
101-
/// certain level of understanding of the underlying implementation, users may use the
102-
/// <see cref="Precision" /> parameter instead.
103-
/// </summary>
104-
[DataMember(Name ="tree_levels")]
105-
[Obsolete("Removed in Elasticsearch 6.6")]
106-
int? TreeLevels { get; set; }
107-
10851
/// <summary>
10952
/// Should the data be coerced into becoming a valid geo shape (for instance closing a polygon)
11053
/// </summary>
@@ -118,10 +61,6 @@ public class GeoShapeProperty : DocValuesPropertyBase, IGeoShapeProperty
11861
{
11962
public GeoShapeProperty() : base(FieldType.GeoShape) { }
12063

121-
/// <inheritdoc />
122-
[Obsolete("Removed in Elasticsearch 6.6")]
123-
public double? DistanceErrorPercentage { get; set; }
124-
12564
/// <inheritdoc />
12665
public bool? IgnoreMalformed { get; set; }
12766

@@ -131,25 +70,9 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { }
13170
/// <inheritdoc />
13271
public GeoOrientation? Orientation { get; set; }
13372

134-
/// <inheritdoc />
135-
[Obsolete("Removed in Elasticsearch 6.6")]
136-
public bool? PointsOnly { get; set; }
137-
138-
/// <inheritdoc />
139-
[Obsolete("Removed in Elasticsearch 6.6")]
140-
public Distance Precision { get; set; }
141-
14273
/// <inheritdoc />
14374
public GeoStrategy? Strategy { get; set; }
14475

145-
/// <inheritdoc />
146-
[Obsolete("Removed in Elasticsearch 6.6")]
147-
public GeoTree? Tree { get; set; }
148-
149-
/// <inheritdoc />
150-
[Obsolete("Removed in Elasticsearch 6.6")]
151-
public int? TreeLevels { get; set; }
152-
15376
/// <inheritdoc />
15477
public bool? Coerce { get; set; }
15578
}
@@ -163,55 +86,20 @@ public class GeoShapePropertyDescriptor<T>
16386
public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }
16487

16588

166-
[Obsolete("Removed in Elasticsearch 6.6")]
167-
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
16889
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
16990
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
17091
GeoOrientation? IGeoShapeProperty.Orientation { get; set; }
171-
172-
[Obsolete("Removed in Elasticsearch 6.6")]
173-
bool? IGeoShapeProperty.PointsOnly { get; set; }
174-
175-
[Obsolete("Removed in Elasticsearch 6.6")]
176-
Distance IGeoShapeProperty.Precision { get; set; }
17792
GeoStrategy? IGeoShapeProperty.Strategy { get; set; }
178-
179-
[Obsolete("Removed in Elasticsearch 6.6")]
180-
GeoTree? IGeoShapeProperty.Tree { get; set; }
181-
182-
[Obsolete("Removed in Elasticsearch 6.6")]
183-
int? IGeoShapeProperty.TreeLevels { get; set; }
18493
bool? IGeoShapeProperty.Coerce { get; set; }
18594

18695
/// <inheritdoc cref="IGeoShapeProperty.Tree" />
18796

188-
[Obsolete("Removed in Elasticsearch 6.6")]
189-
public GeoShapePropertyDescriptor<T> Tree(GeoTree? tree) => Assign(tree, (a, v) => a.Tree = v);
190-
191-
/// <inheritdoc cref="IGeoShapeProperty.TreeLevels" />
192-
[Obsolete("Removed in Elasticsearch 6.6")]
193-
public GeoShapePropertyDescriptor<T> TreeLevels(int? treeLevels) => Assign(treeLevels, (a, v) => a.TreeLevels = v);
194-
19597
/// <inheritdoc cref="IGeoShapeProperty.Strategy" />
19698
public GeoShapePropertyDescriptor<T> Strategy(GeoStrategy? strategy) => Assign(strategy, (a, v) => a.Strategy = v);
19799

198-
/// <inheritdoc cref="IGeoShapeProperty.Precision" />
199-
[Obsolete("Removed in Elasticsearch 6.6")]
200-
public GeoShapePropertyDescriptor<T> Precision(double precision, DistanceUnit unit) =>
201-
Assign(new Distance(precision, unit), (a, v) => a.Precision = v);
202-
203100
/// <inheritdoc cref="IGeoShapeProperty.Orientation" />
204101
public GeoShapePropertyDescriptor<T> Orientation(GeoOrientation? orientation) => Assign(orientation, (a, v) => a.Orientation = v);
205102

206-
/// <inheritdoc cref="IGeoShapeProperty.DistanceErrorPercentage" />
207-
[Obsolete("Removed in Elasticsearch 6.6")]
208-
public GeoShapePropertyDescriptor<T> DistanceErrorPercentage(double? distanceErrorPercentage) =>
209-
Assign(distanceErrorPercentage, (a, v) => a.DistanceErrorPercentage = v);
210-
211-
/// <inheritdoc cref="IGeoShapeProperty.PointsOnly" />
212-
[Obsolete("Removed in Elasticsearch 6.6")]
213-
public GeoShapePropertyDescriptor<T> PointsOnly(bool? pointsOnly = true) => Assign(pointsOnly, (a, v) => a.PointsOnly = v);
214-
215103
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed" />
216104
public GeoShapePropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) =>
217105
Assign(ignoreMalformed, (a, v) => a.IgnoreMalformed = v);

src/Tests/Tests/Mapping/Types/Geo/GeoShape/GeoShapeAttributeTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ namespace Tests.Mapping.Types.Geo.GeoShape
55
public class GeoShapeTest
66
{
77
[GeoShape(
8-
Tree = GeoTree.Quadtree,
98
Orientation = GeoOrientation.ClockWise,
109
Strategy = GeoStrategy.Recursive,
11-
TreeLevels = 3,
12-
PointsOnly = true,
13-
DistanceErrorPercentage = 1.0,
1410
Coerce = true)]
1511
public object Full { get; set; }
1612

@@ -27,12 +23,8 @@ public class GeoShapeAttributeTests : AttributeTestsBase<GeoShapeTest>
2723
full = new
2824
{
2925
type = "geo_shape",
30-
tree = "quadtree",
3126
orientation = "cw",
3227
strategy = "recursive",
33-
tree_levels = 3,
34-
points_only = true,
35-
distance_error_pct = 1.0,
3628
coerce = true
3729
},
3830
minimal = new

src/Tests/Tests/Mapping/Types/Geo/GeoShape/GeoShapePropertyTests.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ public GeoShapePropertyTests(WritableCluster cluster, EndpointUsage usage) : bas
1717
location = new
1818
{
1919
type = "geo_shape",
20-
tree = "quadtree",
2120
orientation = "cw",
2221
strategy = "recursive",
23-
tree_levels = 3,
24-
points_only = true,
25-
distance_error_pct = 1.0,
2622
coerce = true
2723
}
2824
}
@@ -31,12 +27,8 @@ public GeoShapePropertyTests(WritableCluster cluster, EndpointUsage usage) : bas
3127
protected override Func<PropertiesDescriptor<Project>, IPromise<IProperties>> FluentProperties => f => f
3228
.GeoShape(s => s
3329
.Name(p => p.Location)
34-
.Tree(GeoTree.Quadtree)
3530
.Orientation(GeoOrientation.ClockWise)
3631
.Strategy(GeoStrategy.Recursive)
37-
.TreeLevels(3)
38-
.PointsOnly()
39-
.DistanceErrorPercentage(1.0)
4032
.Coerce()
4133
);
4234

@@ -46,12 +38,8 @@ public GeoShapePropertyTests(WritableCluster cluster, EndpointUsage usage) : bas
4638
{
4739
"location", new GeoShapeProperty
4840
{
49-
Tree = GeoTree.Quadtree,
5041
Orientation = GeoOrientation.ClockWise,
5142
Strategy = GeoStrategy.Recursive,
52-
TreeLevels = 3,
53-
PointsOnly = true,
54-
DistanceErrorPercentage = 1.0,
5543
Coerce = true
5644
}
5745
}

0 commit comments

Comments
 (0)