Skip to content

Commit

Permalink
Cleaning up geo as per elastic/elasticsearch#22876
Browse files Browse the repository at this point in the history
* For `geo_distance` queries, sorting, and aggregations the `sloppy_arc` option
* The `geo_distance_range` query, which was deprecated in 5.0, has been removed.
* The `optimize_bbox` parameter has been removed from `geo_distance` queries.
* The `ignore_malformed` and `coerce` parameters have been removed from `geo_bounding_box`, `geo_polygon`, and `geo_distance` queries.
  • Loading branch information
Mpdreamz committed Feb 16, 2017
1 parent 0a32831 commit 45efa3b
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 319 deletions.
2 changes: 0 additions & 2 deletions src/Nest/Nest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1109,11 +1109,9 @@
<Compile Include="QueryDsl\Geo\BoundingBox\BoundingBox.cs" />
<Compile Include="QueryDsl\Geo\BoundingBox\GeoBoundingBoxQuery.cs" />
<Compile Include="QueryDsl\Geo\BoundingBox\GeoExecution.cs" />
<Compile Include="QueryDsl\Geo\DistanceRange\GeoDistanceRangeQuery.cs" />
<Compile Include="QueryDsl\Geo\Distance\GeoDistanceQuery.cs" />
<Compile Include="QueryDsl\Geo\GeoCoordinateJsonConverter.cs" />
<Compile Include="QueryDsl\Geo\GeoLocation.cs" />
<Compile Include="QueryDsl\Geo\GeoOptimizeBBox.cs" />
<Compile Include="QueryDsl\Geo\GeoValidationMethod.cs" />
<Compile Include="QueryDsl\Geo\HashCell\GeoHashCellQuery.cs" />
<Compile Include="QueryDsl\Geo\LatLon.cs" />
Expand Down
3 changes: 0 additions & 3 deletions src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ public interface IQueryContainer
[JsonProperty("geo_polygon")]
IGeoPolygonQuery GeoPolygon { get; set; }

[JsonProperty("geo_distance_range")]
IGeoDistanceRangeQuery GeoDistanceRange { get; set; }

[JsonProperty("geohash_cell")]
IGeoHashCellQuery GeoHashCell { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public partial class QueryContainer : IQueryContainer, IDescriptor
private IGeoBoundingBoxQuery _geoBoundingBox;
private IGeoDistanceQuery _geoDistance;
private IGeoPolygonQuery _geoPolygon;
private IGeoDistanceRangeQuery _geoDistanceRange;
private IGeoHashCellQuery _geoHashCell;
private IScriptQuery _script;
private IExistsQuery _exists;
Expand Down Expand Up @@ -115,7 +114,6 @@ private T Set<T>(T value) where T : IQuery
IGeoBoundingBoxQuery IQueryContainer.GeoBoundingBox { get { return _geoBoundingBox; } set { _geoBoundingBox = Set(value); } }
IGeoDistanceQuery IQueryContainer.GeoDistance { get { return _geoDistance; } set { _geoDistance = Set(value); } }
IGeoPolygonQuery IQueryContainer.GeoPolygon { get { return _geoPolygon; } set { _geoPolygon = Set(value); } }
IGeoDistanceRangeQuery IQueryContainer.GeoDistanceRange { get { return _geoDistanceRange; } set { _geoDistanceRange = Set(value); } }
IGeoHashCellQuery IQueryContainer.GeoHashCell { get { return _geoHashCell; } set { _geoHashCell = Set(value); } }
IScriptQuery IQueryContainer.Script { get { return _script; } set { _script = Set(value); } }
IExistsQuery IQueryContainer.Exists { get { return _exists; } set { _exists = Set(value); } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public QueryContainer Terms(Func<TermsQueryDescriptor<T>, ITermsQuery> selector)

/// <summary>
/// A fuzzy based query that uses similarity based on Levenshtein (edit distance) algorithm.
/// Warning: this query is not very scalable with its default prefix length of 0 in this case,
/// Warning: this query is not very scalable with its default prefix length of 0 in this case,
/// every term will be enumerated and cause an edit score calculation or max_expansions is not set.
/// </summary>
public QueryContainer Fuzzy(Func<FuzzyQueryDescriptor<T>, IFuzzyQuery> selector) =>
Expand Down Expand Up @@ -157,7 +157,7 @@ public QueryContainer TermRange(Func<TermRangeQueryDescriptor<T>, ITermRangeQuer
WrapInContainer(selector, (query, container) => container.Range = query);

/// <summary>
/// More like this query find documents that are like provided text by running it against one or more fields.
/// More like this query find documents that are like provided text by running it against one or more fields.
/// </summary>
public QueryContainer MoreLikeThis(Func<MoreLikeThisQueryDescriptor<T>, IMoreLikeThisQuery> selector) =>
WrapInContainer(selector, (query, container) => container.MoreLikeThis = query);
Expand Down Expand Up @@ -241,13 +241,6 @@ public QueryContainer GeoPolygon(Func<GeoPolygonQueryDescriptor<T>, IGeoPolygonQ
public QueryContainer GeoHashCell(Func<GeoHashCellQueryDescriptor<T>, IGeoHashCellQuery> selector) =>
WrapInContainer(selector, (query, container) => container.GeoHashCell = query);

/// <summary>
/// Matches documents with a geo_point type field to include only those
/// that exist within a specific distance range from a given geo_point
/// </summary>
public QueryContainer GeoDistanceRange(Func<GeoDistanceRangeQueryDescriptor<T>, IGeoDistanceRangeQuery> selector) =>
WrapInContainer(selector, (query, container) => container.GeoDistanceRange = query);

/// <summary>
/// Matches documents with a geo_point type field to include only those
/// that exist within a specific distance from a given geo_point
Expand Down Expand Up @@ -449,14 +442,14 @@ public QueryContainer SpanMultiTerm(Func<SpanMultiTermQueryDescriptor<T>, ISpanM
WrapInContainer(selector, (query, container) => container.SpanMultiTerm = query);

/// <summary>
/// Returns matches which enclose another span query.
/// Returns matches which enclose another span query.
/// The span containing query maps to Lucene SpanContainingQuery
/// </summary>
public QueryContainer SpanContaining(Func<SpanContainingQueryDescriptor<T>, ISpanContainingQuery> selector) =>
WrapInContainer(selector, (query, container) => container.SpanContaining = query);

/// <summary>
/// Returns Matches which are enclosed inside another span query.
/// Returns Matches which are enclosed inside another span query.
/// The span within query maps to Lucene SpanWithinQuery
/// </summary>
public QueryContainer SpanWithin(Func<SpanWithinQueryDescriptor<T>, ISpanWithinQuery> selector) =>
Expand All @@ -472,8 +465,8 @@ public QueryContainer SpanFieldMasking(Func<SpanFieldMaskingQueryDescriptor<T>,
WrapInContainer(selector, (query, container) => container.SpanFieldMasking = query);

/// <summary>
/// Allows you to use regular expression term queries.
/// "term queries" means that Elasticsearch will apply the regexp to the terms produced
/// Allows you to use regular expression term queries.
/// "term queries" means that Elasticsearch will apply the regexp to the terms produced
/// by the tokenizer for that field, and not to the original text of the field.
/// </summary>
public QueryContainer Regexp(Func<RegexpQueryDescriptor<T>, IRegexpQuery> selector) =>
Expand Down
21 changes: 0 additions & 21 deletions src/Nest/QueryDsl/Geo/BoundingBox/GeoBoundingBoxQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ public interface IGeoBoundingBoxQuery : IFieldNameQuery
[JsonProperty("type")]
GeoExecution? Type { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("coerce")]
bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

[JsonProperty("validation_method")]
GeoValidationMethod? ValidationMethod { get; set; }
}
Expand All @@ -32,11 +24,6 @@ public class GeoBoundingBoxQuery : FieldNameQueryBase, IGeoBoundingBoxQuery
public IBoundingBox BoundingBox { get; set; }
public GeoExecution? Type { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? IgnoreMalformed { get; set; }
public GeoValidationMethod? ValidationMethod { get; set; }

internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoBoundingBox = this;
Expand All @@ -52,8 +39,6 @@ public class GeoBoundingBoxQueryDescriptor<T>
protected override bool Conditionless => GeoBoundingBoxQuery.IsConditionless(this);
IBoundingBox IGeoBoundingBoxQuery.BoundingBox { get; set; }
GeoExecution? IGeoBoundingBoxQuery.Type { get; set; }
bool? IGeoBoundingBoxQuery.Coerce { get; set; }
bool? IGeoBoundingBoxQuery.IgnoreMalformed { get; set; }
GeoValidationMethod? IGeoBoundingBoxQuery.ValidationMethod { get; set; }

public GeoBoundingBoxQueryDescriptor<T> BoundingBox(double topLeftLat, double topLeftLon, double bottomRightLat, double bottomRightLon) =>
Expand All @@ -67,12 +52,6 @@ public GeoBoundingBoxQueryDescriptor<T> BoundingBox(Func<BoundingBoxDescriptor,

public GeoBoundingBoxQueryDescriptor<T> Type(GeoExecution type) => Assign(a => a.Type = type);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoBoundingBoxQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoBoundingBoxQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);

public GeoBoundingBoxQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
}
}
30 changes: 0 additions & 30 deletions src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,9 @@ public interface IGeoDistanceQuery : IFieldNameQuery
[JsonProperty("distance")]
Distance Distance { get; set; }

[JsonProperty("optimize_bbox")]
GeoOptimizeBBox? OptimizeBoundingBox { get; set; }

[JsonProperty("distance_type")]
GeoDistanceType? DistanceType { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("coerce")]
bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

[JsonProperty("validation_method")]
GeoValidationMethod? ValidationMethod { get; set; }

Expand All @@ -37,15 +26,7 @@ public class GeoDistanceQuery : FieldNameQueryBase, IGeoDistanceQuery
protected override bool Conditionless => IsConditionless(this);
public GeoLocation Location { get; set; }
public Distance Distance { get; set; }
public GeoOptimizeBBox? OptimizeBoundingBox { get; set; }
public GeoDistanceType? DistanceType { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? IgnoreMalformed { get; set; }

public GeoValidationMethod? ValidationMethod { get; set; }

internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoDistance = this;
Expand All @@ -62,9 +43,6 @@ public class GeoDistanceQueryDescriptor<T>
GeoLocation IGeoDistanceQuery.Location { get; set; }
Distance IGeoDistanceQuery.Distance { get; set; }
GeoDistanceType? IGeoDistanceQuery.DistanceType { get; set; }
GeoOptimizeBBox? IGeoDistanceQuery.OptimizeBoundingBox { get; set; }
bool? IGeoDistanceQuery.Coerce { get; set; }
bool? IGeoDistanceQuery.IgnoreMalformed { get; set; }
GeoValidationMethod? IGeoDistanceQuery.ValidationMethod { get; set; }

public GeoDistanceQueryDescriptor<T> Location(GeoLocation location) => Assign(a => a.Location = location);
Expand All @@ -75,16 +53,8 @@ public class GeoDistanceQueryDescriptor<T>

public GeoDistanceQueryDescriptor<T> Distance(double distance, DistanceUnit unit) => Assign(a => a.Distance = new Distance(distance, unit));

public GeoDistanceQueryDescriptor<T> Optimize(GeoOptimizeBBox optimize) => Assign(a => a.OptimizeBoundingBox = optimize);

public GeoDistanceQueryDescriptor<T> DistanceType(GeoDistanceType type) => Assign(a => a.DistanceType = type);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoDistanceQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoDistanceQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);

public GeoDistanceQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
}
}
115 changes: 0 additions & 115 deletions src/Nest/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQuery.cs

This file was deleted.

17 changes: 0 additions & 17 deletions src/Nest/QueryDsl/Geo/GeoOptimizeBBox.cs

This file was deleted.

21 changes: 0 additions & 21 deletions src/Nest/QueryDsl/Geo/Polygon/GeoPolygonQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ public interface IGeoPolygonQuery : IFieldNameQuery
[VariableField("points")]
IEnumerable<GeoLocation> Points { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("coerce")]
bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

[JsonProperty("validation_method")]
GeoValidationMethod? ValidationMethod { get; set; }

Expand All @@ -29,11 +21,6 @@ public class GeoPolygonQuery : FieldNameQueryBase, IGeoPolygonQuery
protected override bool Conditionless => IsConditionless(this);
public IEnumerable<GeoLocation> Points { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? Coerce { get; set; }

[Obsolete("Deprecated. Use ValidationMethod")]
public bool? IgnoreMalformed { get; set; }
public GeoValidationMethod? ValidationMethod { get; set; }

internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoPolygon = this;
Expand All @@ -46,20 +33,12 @@ public class GeoPolygonQueryDescriptor<T>
{
protected override bool Conditionless => GeoPolygonQuery.IsConditionless(this);
IEnumerable<GeoLocation> IGeoPolygonQuery.Points { get; set; }
bool? IGeoPolygonQuery.Coerce { get; set; }
bool? IGeoPolygonQuery.IgnoreMalformed { get; set; }
GeoValidationMethod? IGeoPolygonQuery.ValidationMethod { get; set; }

public GeoPolygonQueryDescriptor<T> Points(IEnumerable<GeoLocation> points) => Assign(a => a.Points = points);

public GeoPolygonQueryDescriptor<T> Points(params GeoLocation[] points) => Assign(a => a.Points = points);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoPolygonQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);

[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
public GeoPolygonQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);

public GeoPolygonQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
}
}
Loading

0 comments on commit 45efa3b

Please sign in to comment.