Skip to content

Commit e46c70d

Browse files
russcamMpdreamz
authored andcommitted
Include LatLongDetector on DetectorsDescriptor<T> (#3384)
Closes #3383
1 parent 491a4a4 commit e46c70d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,8 @@ public DetectorsDescriptor<T> TimeOfDay(Func<TimeDetectorDescriptor<T>, ITimeDet
285285

286286
public DetectorsDescriptor<T> TimeOfWeek(Func<TimeDetectorDescriptor<T>, ITimeDetector> selector = null) =>
287287
Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new TimeDetectorDescriptor<T>(TimeFunction.TimeOfWeek))));
288+
289+
public DetectorsDescriptor<T> LatLong(Func<LatLongDetectorDescriptor<T>, IGeographicDetector> selector = null) =>
290+
Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new LatLongDetectorDescriptor<T>())));
288291
}
289292
}

src/Nest/XPack/MachineLearning/Job/Detectors/GeographicDetector.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ public class LatLongDetectorDescriptor<T> : DetectorDescriptorBase<LatLongDetect
4444
Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
4545
Field IFieldNameDetector.FieldName { get; set; }
4646

47+
[Obsolete("Use parameterless constructor")]
4748
public LatLongDetectorDescriptor(string function) : base(function) {}
4849

50+
public LatLongDetectorDescriptor() : base(GeographicFunction.LatLong.GetStringValue()) {}
51+
4952
public LatLongDetectorDescriptor<T> FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
5053

5154
public LatLongDetectorDescriptor<T> FieldName(Expression<Func<T, object>> objectPath) => Assign(a => a.FieldName = objectPath);

0 commit comments

Comments
 (0)