Skip to content

Commit

Permalink
Fix #3318 Support 3rd dimension (Z value) to points for geo_point and… (
Browse files Browse the repository at this point in the history
#3365)

This commit adds support for 3rd dimension (Z value) to points for geo_shapes

GeoShapeAttribute needs to implement IGeoShapeProperty
  • Loading branch information
Mpdreamz authored and russcam committed Aug 20, 2018
1 parent e24dbdd commit 0e86f0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public GeoShapeAttribute() : base(FieldType.GeoShape) { }
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
bool? IGeoShapeProperty.PointsOnly { get; set; }
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
bool? IGeoShapeProperty.IgnoreZValue { get; set; }

/// <inheritdoc cref="IGeoShapeProperty.Tree"/>
public GeoTree Tree { get => Self.Tree.GetValueOrDefault(GeoTree.Geohash); set => Self.Tree = value; }
Expand All @@ -36,5 +37,7 @@ public double DistanceErrorPercentage
public bool PointsOnly { get => Self.PointsOnly.GetValueOrDefault(false); set => Self.PointsOnly = value; }
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
public bool IgnoreMalformed { get => Self.IgnoreMalformed.GetValueOrDefault(false); set => Self.IgnoreMalformed = value; }
/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(true); set => Self.IgnoreZValue = value; }
}
}
20 changes: 20 additions & 0 deletions src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public interface IGeoShapeProperty : IDocValuesProperty
/// </remarks>
[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

/// <summary>
/// If true (default) three dimension points will be accepted (stored in source) but
/// only latitude and longitude values will be indexed; the third dimension is ignored. If false,
/// geo-points containing any more than latitude and longitude (two dimensions) values throw
/// an exception and reject the whole document.
/// </summary>
/// <remarks>
/// Valid for Elasticsearch 6.3.0+
/// </remarks>
[JsonProperty("ignore_z_value")]
bool? IgnoreZValue { get; set; }
}

/// <inheritdoc cref="IGeoShapeProperty" />
Expand Down Expand Up @@ -116,6 +128,9 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { }

/// <inheritdoc />
public bool? IgnoreMalformed { get; set; }

/// <inheritdoc />
public bool? IgnoreZValue { get; set; }
}

/// <inheritdoc cref="IGeoShapeProperty"/>
Expand All @@ -132,6 +147,7 @@ public class GeoShapePropertyDescriptor<T>
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
bool? IGeoShapeProperty.PointsOnly { get; set; }
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
bool? IGeoShapeProperty.IgnoreZValue { get; set; }

public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }

Expand Down Expand Up @@ -161,5 +177,9 @@ public GeoShapePropertyDescriptor<T> DistanceErrorPercentage(double? distanceErr
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
public GeoShapePropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) =>
Assign(a => a.IgnoreMalformed = ignoreMalformed);

/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
public GeoShapePropertyDescriptor<T> IgnoreZValue(bool? ignoreZValue = true) =>
Assign(a => a.IgnoreZValue = ignoreZValue);
}
}

0 comments on commit 0e86f0b

Please sign in to comment.