Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,8 @@ public DetectorsDescriptor<T> TimeOfDay(Func<TimeDetectorDescriptor<T>, ITimeDet

public DetectorsDescriptor<T> TimeOfWeek(Func<TimeDetectorDescriptor<T>, ITimeDetector> selector = null) =>
Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new TimeDetectorDescriptor<T>(TimeFunction.TimeOfWeek))));

public DetectorsDescriptor<T> LatLong(Func<LatLongDetectorDescriptor<T>, IGeographicDetector> selector = null) =>
Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new LatLongDetectorDescriptor<T>())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ public class LatLongDetectorDescriptor<T> : DetectorDescriptorBase<LatLongDetect
Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
Field IFieldNameDetector.FieldName { get; set; }

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

public LatLongDetectorDescriptor() : base(GeographicFunction.LatLong.GetStringValue()) {}

public LatLongDetectorDescriptor<T> FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);

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