Skip to content

Commit a50f8a1

Browse files
committed
Add missing datatype members to IPropertiesDescriptor (#4366)
This commit - Adds missing datatype method members to IPropertiesDescriptor<T, out TReturnType> interface that were implemented on the concrete implementation PropertiesDescriptor<T>, but not the concrete implementation SingleMappingSelector<T>. - Adds XML docs to IProperty type - Adds conventions tests for IPropertyDescriptor<,> to ensure that there is a descriptor method for all IProperty types, and that the interface IPropertyDescriptor<,> has an IProperty method implementation for all methods defined on PropertyDescriptor<T> (cherry picked from commit 07bfc0a)
1 parent aab4d3c commit a50f8a1

File tree

26 files changed

+258
-25
lines changed

26 files changed

+258
-25
lines changed

src/Nest/Mapping/DynamicTemplate/SingleMapping.cs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,95 @@ namespace Nest
66
{
77
public class SingleMappingSelector<T> : SelectorBase, IPropertiesDescriptor<T, IProperty> where T : class
88
{
9+
/// <inheritdoc />
910
public IProperty Binary(Func<BinaryPropertyDescriptor<T>, IBinaryProperty> selector) =>
1011
selector?.Invoke(new BinaryPropertyDescriptor<T>());
1112

13+
/// <inheritdoc />
1214
public IProperty Boolean(Func<BooleanPropertyDescriptor<T>, IBooleanProperty> selector) =>
1315
selector?.Invoke(new BooleanPropertyDescriptor<T>());
1416

17+
/// <inheritdoc />
1518
public IProperty Completion(Func<CompletionPropertyDescriptor<T>, ICompletionProperty> selector) =>
1619
selector?.Invoke(new CompletionPropertyDescriptor<T>());
1720

21+
/// <inheritdoc />
1822
public IProperty Date(Func<DatePropertyDescriptor<T>, IDateProperty> selector) =>
1923
selector?.Invoke(new DatePropertyDescriptor<T>());
2024

25+
/// <inheritdoc />
2126
public IProperty DateNanos(Func<DateNanosPropertyDescriptor<T>, IDateNanosProperty> selector) =>
2227
selector?.Invoke(new DateNanosPropertyDescriptor<T>());
2328

29+
/// <inheritdoc />
2430
public IProperty DateRange(Func<DateRangePropertyDescriptor<T>, IDateRangeProperty> selector) =>
2531
selector?.Invoke(new DateRangePropertyDescriptor<T>());
2632

33+
/// <inheritdoc />
2734
public IProperty DoubleRange(Func<DoubleRangePropertyDescriptor<T>, IDoubleRangeProperty> selector) =>
2835
selector?.Invoke(new DoubleRangePropertyDescriptor<T>());
2936

37+
/// <inheritdoc />
3038
public IProperty FloatRange(Func<FloatRangePropertyDescriptor<T>, IFloatRangeProperty> selector) =>
3139
selector?.Invoke(new FloatRangePropertyDescriptor<T>());
3240

41+
/// <inheritdoc />
3342
public IProperty GeoPoint(Func<GeoPointPropertyDescriptor<T>, IGeoPointProperty> selector) =>
3443
selector?.Invoke(new GeoPointPropertyDescriptor<T>());
3544

45+
/// <inheritdoc />
3646
public IProperty GeoShape(Func<GeoShapePropertyDescriptor<T>, IGeoShapeProperty> selector) =>
3747
selector?.Invoke(new GeoShapePropertyDescriptor<T>());
3848

49+
/// <inheritdoc />
3950
public IProperty Shape(Func<ShapePropertyDescriptor<T>, IShapeProperty> selector) =>
4051
selector?.Invoke(new ShapePropertyDescriptor<T>());
4152

53+
/// <inheritdoc />
4254
public IProperty IntegerRange(Func<IntegerRangePropertyDescriptor<T>, IIntegerRangeProperty> selector) =>
4355
selector?.Invoke(new IntegerRangePropertyDescriptor<T>());
4456

57+
/// <inheritdoc />
4558
public IProperty Ip(Func<IpPropertyDescriptor<T>, IIpProperty> selector) =>
4659
selector?.Invoke(new IpPropertyDescriptor<T>());
4760

61+
/// <inheritdoc />
4862
public IProperty IpRange(Func<IpRangePropertyDescriptor<T>, IIpRangeProperty> selector) =>
4963
selector?.Invoke(new IpRangePropertyDescriptor<T>());
5064

65+
/// <inheritdoc />
5166
public IProperty Join(Func<JoinPropertyDescriptor<T>, IJoinProperty> selector) =>
5267
selector?.Invoke(new JoinPropertyDescriptor<T>());
5368

69+
/// <inheritdoc />
70+
public IProperty FieldAlias(Func<FieldAliasPropertyDescriptor<T>, IFieldAliasProperty> selector) =>
71+
selector?.Invoke(new FieldAliasPropertyDescriptor<T>());
72+
73+
/// <inheritdoc />
74+
public IProperty RankFeature(Func<RankFeaturePropertyDescriptor<T>, IRankFeatureProperty> selector) =>
75+
selector?.Invoke(new RankFeaturePropertyDescriptor<T>());
76+
77+
/// <inheritdoc />
78+
public IProperty RankFeatures(Func<RankFeaturesPropertyDescriptor<T>, IRankFeaturesProperty> selector) =>
79+
selector?.Invoke(new RankFeaturesPropertyDescriptor<T>());
80+
81+
/// <inheritdoc />
82+
public IProperty Flattened(Func<FlattenedPropertyDescriptor<T>, IFlattenedProperty> selector) =>
83+
selector?.Invoke(new FlattenedPropertyDescriptor<T>());
84+
85+
/// <inheritdoc />
5486
public IProperty Keyword(Func<KeywordPropertyDescriptor<T>, IKeywordProperty> selector) =>
5587
selector?.Invoke(new KeywordPropertyDescriptor<T>());
5688

89+
/// <inheritdoc />
5790
public IProperty LongRange(Func<LongRangePropertyDescriptor<T>, ILongRangeProperty> selector) =>
5891
selector?.Invoke(new LongRangePropertyDescriptor<T>());
5992

93+
/// <inheritdoc />
6094
public IProperty Murmur3Hash(Func<Murmur3HashPropertyDescriptor<T>, IMurmur3HashProperty> selector) =>
6195
selector?.Invoke(new Murmur3HashPropertyDescriptor<T>());
6296

97+
/// <inheritdoc />
6398
public IProperty Nested<TChild>(Func<NestedPropertyDescriptor<T, TChild>, INestedProperty> selector)
6499
where TChild : class => selector?.Invoke(new NestedPropertyDescriptor<T, TChild>());
65100

@@ -70,21 +105,30 @@ public IProperty Nested<TChild>(Func<NestedPropertyDescriptor<T, TChild>, INeste
70105
public IProperty Number(Func<NumberPropertyDescriptor<T>, INumberProperty> selector) =>
71106
selector?.Invoke(new NumberPropertyDescriptor<T>());
72107

108+
/// <inheritdoc />
73109
public IProperty Object<TChild>(Func<ObjectTypeDescriptor<T, TChild>, IObjectProperty> selector)
74110
where TChild : class => selector?.Invoke(new ObjectTypeDescriptor<T, TChild>());
75111

112+
/// <inheritdoc />
76113
public IProperty Percolator(Func<PercolatorPropertyDescriptor<T>, IPercolatorProperty> selector) =>
77114
selector?.Invoke(new PercolatorPropertyDescriptor<T>());
78115

116+
/// <inheritdoc />
79117
public IProperty Text(Func<TextPropertyDescriptor<T>, ITextProperty> selector) =>
80118
selector?.Invoke(new TextPropertyDescriptor<T>());
81119

120+
/// <inheritdoc />
82121
public IProperty TokenCount(Func<TokenCountPropertyDescriptor<T>, ITokenCountProperty> selector) =>
83122
selector?.Invoke(new TokenCountPropertyDescriptor<T>());
84123

124+
/// <inheritdoc />
85125
public IProperty Generic(Func<GenericPropertyDescriptor<T>, IGenericProperty> selector) =>
86126
selector?.Invoke(new GenericPropertyDescriptor<T>());
87127

128+
/// <inheritdoc />
129+
public IProperty SearchAsYouType(Func<SearchAsYouTypePropertyDescriptor<T>, ISearchAsYouTypeProperty> selector) =>
130+
selector?.Invoke(new SearchAsYouTypePropertyDescriptor<T>());
131+
88132
#pragma warning disable CS3001 // Argument type is not CLS-compliant
89133
public IProperty Scalar(Expression<Func<T, int>> field, Func<NumberPropertyDescriptor<T>, INumberProperty> selector = null) =>
90134
selector.InvokeOrDefault(new NumberPropertyDescriptor<T>().Name(field).Type(NumberType.Integer));
@@ -319,9 +363,5 @@ public IProperty Scalar(Expression<Func<T, FloatRange>> field, Func<FloatRangePr
319363
public IProperty Scalar(Expression<Func<T, IpAddressRange>> field, Func<IpRangePropertyDescriptor<T>, IIpRangeProperty> selector = null) =>
320364
selector.InvokeOrDefault(new IpRangePropertyDescriptor<T>().Name(field));
321365
#pragma warning restore CS3001 // Argument type is not CLS-compliant
322-
323-
/// <inheritdoc cref="ISearchAsYouTypeProperty"/>
324-
public IProperty SearchAsYouType(Func<SearchAsYouTypePropertyDescriptor<T>, ISearchAsYouTypeProperty> selector) =>
325-
selector?.Invoke(new SearchAsYouTypePropertyDescriptor<T>());
326366
}
327367
}

src/Nest/Mapping/Types/Complex/Nested/NestedProperty.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,40 @@
44

55
namespace Nest
66
{
7+
/// <summary>
8+
/// A specialised version of the <see cref="IObjectProperty"/> datatype that allows arrays of objects
9+
/// to be indexed in a way that they can be queried independently of each other, using nested queries
10+
/// and aggregations.
11+
/// </summary>
712
[InterfaceDataContract]
813
public interface INestedProperty : IObjectProperty
914
{
15+
/// <summary>
16+
/// Whether to also index nested objects as flattened values on the parent document.
17+
/// </summary>
1018
[DataMember(Name = "include_in_parent")]
1119
bool? IncludeInParent { get; set; }
1220

21+
/// <summary>
22+
/// Whether to also index nested objects as flattened values on the root document.
23+
/// </summary>
1324
[DataMember(Name = "include_in_root")]
1425
bool? IncludeInRoot { get; set; }
1526
}
1627

28+
/// <inheritdoc cref="INestedProperty"/>
1729
[DebuggerDisplay("{DebugDisplay}")]
1830
public class NestedProperty : ObjectProperty, INestedProperty
1931
{
2032
public NestedProperty() : base(FieldType.Nested) { }
2133

34+
/// <inheritdoc />
2235
public bool? IncludeInParent { get; set; }
36+
/// <inheritdoc />
2337
public bool? IncludeInRoot { get; set; }
2438
}
2539

40+
/// <inheritdoc cref="INestedProperty"/>
2641
[DebuggerDisplay("{DebugDisplay}")]
2742
public class NestedPropertyDescriptor<TParent, TChild>
2843
: ObjectPropertyDescriptorBase<NestedPropertyDescriptor<TParent, TChild>, INestedProperty, TParent, TChild>
@@ -35,9 +50,11 @@ public NestedPropertyDescriptor() : base(FieldType.Nested) { }
3550
bool? INestedProperty.IncludeInParent { get; set; }
3651
bool? INestedProperty.IncludeInRoot { get; set; }
3752

53+
/// <inheritdoc cref="INestedProperty.IncludeInParent"/>
3854
public NestedPropertyDescriptor<TParent, TChild> IncludeInParent(bool? includeInParent = true) =>
3955
Assign(includeInParent, (a, v) => a.IncludeInParent = v);
4056

57+
/// <inheritdoc cref="INestedProperty.IncludeInRoot"/>
4158
public NestedPropertyDescriptor<TParent, TChild> IncludeInRoot(bool? includeInRoot = true) =>
4259
Assign(includeInRoot, (a, v) => a.IncludeInRoot = v);
4360
}

src/Nest/Mapping/Types/Complex/Object/ObjectProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Nest
77
{
88
/// <summary>
9-
/// A object datatype mapping for an inner object
9+
/// A mapping for an inner object
1010
/// </summary>
1111
[InterfaceDataContract]
1212
public interface IObjectProperty : ICoreProperty

src/Nest/Mapping/Types/Core/Binary/BinaryProperty.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// The binary type accepts a binary value as a Base64 encoded string.
8+
/// The field is not stored by default and is not searchable
9+
/// </summary>
610
[InterfaceDataContract]
711
public interface IBinaryProperty : IDocValuesProperty { }
812

src/Nest/Mapping/Types/Core/Boolean/BooleanProperty.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace Nest
77
{
8+
/// <summary>
9+
/// The boolean fields accepts true and false values
10+
/// </summary>
811
[InterfaceDataContract]
912
public interface IBooleanProperty : IDocValuesProperty
1013
{

src/Nest/Mapping/Types/Core/Date/DateProperty.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace Nest
77
{
8+
/// <summary>
9+
/// The date datatype maps a field as a date in Elasticsearch.
10+
/// </summary>
811
[InterfaceDataContract]
912
public interface IDateProperty : IDocValuesProperty
1013
{

src/Nest/Mapping/Types/Core/DateNanos/DateNanosProperty.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
namespace Nest
77
{
8+
/// <summary>
9+
/// The date nanos datatype is similar to <see cref="IDateProperty"/>, except that
10+
/// internally, the date is stored with nanosecond resolution. This limits its range of
11+
/// dates from roughly 1970 to 2262.
12+
/// </summary>
813
[InterfaceDataContract]
914
public interface IDateNanosProperty : IDocValuesProperty
1015
{

src/Nest/Mapping/Types/Core/Join/JoinProperty.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

66
namespace Nest
77
{
8+
/// <summary>
9+
/// The join datatype is a special field that creates parent/child relation within documents of the same index.
10+
/// </summary>
811
[InterfaceDataContract]
912
public interface IJoinProperty : IProperty
1013
{
1114
/// <summary>
12-
/// Should the field be searchable? Accepts true (default) and false.
15+
/// Defines a set of possible relations within the documents,
16+
/// each relation being a parent name and a child name.
1317
/// </summary>
1418
[DataMember(Name = "relations")]
1519
IRelations Relations { get; set; }
1620
}
1721

22+
/// <inheritdoc cref="IJoinProperty"/>
1823
[DebuggerDisplay("{DebugDisplay}")]
1924
public class JoinProperty : PropertyBase, IJoinProperty
2025
{
@@ -23,6 +28,7 @@ public JoinProperty() : base(FieldType.Join) { }
2328
public IRelations Relations { get; set; }
2429
}
2530

31+
/// <inheritdoc cref="IJoinProperty"/>
2632
[DebuggerDisplay("{DebugDisplay}")]
2733
public class JoinPropertyDescriptor<T> : PropertyDescriptorBase<JoinPropertyDescriptor<T>, IJoinProperty, T>, IJoinProperty
2834
where T : class
@@ -31,6 +37,7 @@ public JoinPropertyDescriptor() : base(FieldType.Join) { }
3137

3238
IRelations IJoinProperty.Relations { get; set; }
3339

40+
/// <inheritdoc cref="IJoinProperty.Relations"/>
3441
public JoinPropertyDescriptor<T> Relations(Func<RelationsDescriptor, IPromise<IRelations>> selector) =>
3542
Assign(selector, (a, v) => a.Relations = v?.Invoke(new RelationsDescriptor())?.Value);
3643
}

src/Nest/Mapping/Types/Core/Keyword/KeywordProperty.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
namespace Nest
66
{
7+
/// <summary>
8+
/// A field to index structured content such as IDs, email addresses, hostnames, status codes, zip codes or tags.
9+
/// Used for filtering, sorting, and for aggregations.
10+
/// <para />
11+
/// Keyword fields are only searchable by their exact value.
12+
/// </summary>
713
[InterfaceDataContract]
814
public interface IKeywordProperty : IDocValuesProperty
915
{
@@ -36,6 +42,7 @@ public interface IKeywordProperty : IDocValuesProperty
3642
bool? SplitQueriesOnWhitespace { get; set; }
3743
}
3844

45+
/// <inheritdoc cref="IKeywordProperty"/>
3946
[DebuggerDisplay("{DebugDisplay}")]
4047
public class KeywordProperty : DocValuesPropertyBase, IKeywordProperty
4148
{
@@ -54,6 +61,7 @@ public KeywordProperty() : base(FieldType.Keyword) { }
5461
public bool? SplitQueriesOnWhitespace { get; set; }
5562
}
5663

64+
/// <inheritdoc cref="IKeywordProperty"/>
5765
[DebuggerDisplay("{DebugDisplay}")]
5866
public class KeywordPropertyDescriptor<T>
5967
: DocValuesPropertyDescriptorBase<KeywordPropertyDescriptor<T>, IKeywordProperty, T>, IKeywordProperty

src/Nest/Mapping/Types/Core/Number/NumberProperty.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Nest
88
{
9+
/// <summary>
10+
/// A numeric mapping that defaults to <c>float</c>.
11+
/// </summary>
912
[InterfaceDataContract]
1013
public interface INumberProperty : IDocValuesProperty
1114
{

src/Nest/Mapping/Types/Core/Percolator/PercolatorProperty.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// The percolator datatype is used to store a query, so that the
8+
/// <see cref="IPercolateQuery"/> can use it to match provided documents.
9+
/// </summary>
610
[InterfaceDataContract]
711
public interface IPercolatorProperty : IProperty { }
812

13+
/// <inheritdoc cref="IPercolatorProperty"/>
914
[DebuggerDisplay("{DebugDisplay}")]
1015
public class PercolatorProperty : PropertyBase, IPercolatorProperty
1116
{
1217
public PercolatorProperty() : base(FieldType.Percolator) { }
1318
}
1419

20+
/// <inheritdoc cref="IPercolatorProperty"/>
1521
[DebuggerDisplay("{DebugDisplay}")]
1622
public class PercolatorPropertyDescriptor<T>
1723
: PropertyDescriptorBase<PercolatorPropertyDescriptor<T>, IPercolatorProperty, T>, IPercolatorProperty

src/Nest/Mapping/Types/Core/Range/DateRange/DateRangeProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IDateRangeProperty : IRangeProperty
1717
string Format { get; set; }
1818
}
1919

20-
/// <inheritdoc />
20+
/// <inheritdoc cref="IDateRangeProperty" />
2121
public class DateRangeProperty : RangePropertyBase, IDateRangeProperty
2222
{
2323
public DateRangeProperty() : base(RangeType.DateRange) { }
@@ -26,7 +26,7 @@ public DateRangeProperty() : base(RangeType.DateRange) { }
2626
public string Format { get; set; }
2727
}
2828

29-
/// <inheritdoc />
29+
/// <inheritdoc cref="IDateRangeProperty" />
3030
public class DateRangePropertyDescriptor<T>
3131
: RangePropertyDescriptorBase<DateRangePropertyDescriptor<T>, IDateRangeProperty, T>, IDateRangeProperty
3232
where T : class

src/Nest/Mapping/Types/Core/Range/DoubleRange/DoubleRangeProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Nest
88
[InterfaceDataContract]
99
public interface IDoubleRangeProperty : IRangeProperty { }
1010

11-
/// <inheritdoc />
11+
/// <inheritdoc cref="IDoubleRangeProperty"/>
1212
public class DoubleRangeProperty : RangePropertyBase, IDoubleRangeProperty
1313
{
1414
public DoubleRangeProperty() : base(RangeType.DoubleRange) { }
1515
}
1616

17-
/// <inheritdoc />
17+
/// <inheritdoc cref="IDoubleRangeProperty"/>
1818
public class DoubleRangePropertyDescriptor<T>
1919
: RangePropertyDescriptorBase<DoubleRangePropertyDescriptor<T>, IDoubleRangeProperty, T>, IDoubleRangeProperty
2020
where T : class

src/Nest/Mapping/Types/Core/Range/FloatRange/FloatRangeProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Nest
88
[InterfaceDataContract]
99
public interface IFloatRangeProperty : IRangeProperty { }
1010

11-
/// <inheritdoc />
11+
/// <inheritdoc cref="IFloatRangeProperty"/>
1212
public class FloatRangeProperty : RangePropertyBase, IFloatRangeProperty
1313
{
1414
public FloatRangeProperty() : base(RangeType.FloatRange) { }
1515
}
1616

17-
/// <inheritdoc />
17+
/// <inheritdoc cref="IFloatRangeProperty"/>
1818
public class FloatRangePropertyDescriptor<T>
1919
: RangePropertyDescriptorBase<FloatRangePropertyDescriptor<T>, IFloatRangeProperty, T>, IFloatRangeProperty
2020
where T : class

0 commit comments

Comments
 (0)