33
44namespace Nest
55{
6+
7+ /// <summary>
8+ /// An indexed or artificial document with which to find likeness
9+ /// </summary>
610 [ JsonObject ( MemberSerialization = MemberSerialization . OptIn ) ]
711 [ ContractJsonConverter ( typeof ( ReadAsTypeJsonConverter < LikeDocument < object > > ) ) ]
812 public interface ILikeDocument
913 {
14+ /// <summary>
15+ /// A document to find other documents like
16+ /// </summary>
1017 [ JsonProperty ( "doc" ) ]
1118 [ JsonConverter ( typeof ( SourceConverter ) ) ]
1219 object Document { get ; set ; }
1320
21+ /// <summary>
22+ /// The fields to use for likeness
23+ /// </summary>
1424 [ JsonProperty ( "fields" ) ]
1525 Fields Fields { get ; set ; }
1626
27+ /// <summary>
28+ /// The id of an indexed document to find other documents like
29+ /// </summary>
1730 [ JsonProperty ( "_id" ) ]
1831 Id Id { get ; set ; }
1932
33+ /// <summary>
34+ /// The index of an indexed document to find other documents like
35+ /// </summary>
2036 [ JsonProperty ( "_index" ) ]
2137 IndexName Index { get ; set ; }
2238
39+ /// <summary>
40+ /// A different analyzer than the one defined for the target fields
41+ /// </summary>
2342 [ JsonProperty ( "per_field_analyzer" ) ]
2443 IPerFieldAnalyzer PerFieldAnalyzer { get ; set ; }
2544
45+ /// <summary>
46+ /// The routing value of an indexed document to find other documents like
47+ /// </summary>
2648 [ JsonProperty ( "_routing" ) ]
2749 Routing Routing { get ; set ; }
2850
2951 [ JsonProperty ( "_type" ) ]
3052 TypeName Type { get ; set ; }
3153 }
3254
55+ /// <inheritdoc />
3356 public abstract class LikeDocumentBase : ILikeDocument
3457 {
35- private Routing _routing ;
36-
58+ /// <inheritdoc />
3759 public object Document { get ; set ; }
3860
61+ /// <inheritdoc />
3962 public Fields Fields { get ; set ; }
4063
64+ /// <inheritdoc />
4165 public Id Id { get ; set ; }
66+
67+ /// <inheritdoc />
4268 public IndexName Index { get ; set ; }
4369
70+ /// <inheritdoc />
4471 public IPerFieldAnalyzer PerFieldAnalyzer { get ; set ; }
4572
46- public Routing Routing
47- {
48- get => _routing ?? ( Document == null ? null : new Routing ( Document ) ) ;
49- set => _routing = value ;
50- }
51-
5273 public TypeName Type { get ; set ; }
74+
75+ /// <inheritdoc />
76+ public Routing Routing { get ; set ; }
5377 }
5478
79+ /// <inheritdoc cref="ILikeDocument" />
5580 public class LikeDocument < TDocument > : LikeDocumentBase
5681 where TDocument : class
5782 {
@@ -66,17 +91,16 @@ public LikeDocument(Id id)
6691
6792 public LikeDocument ( TDocument document )
6893 {
69- Id = Id . From ( document ) ;
7094 Document = document ;
7195 Index = typeof ( TDocument ) ;
7296 Type = typeof ( TDocument ) ;
7397 }
7498 }
7599
100+ /// <inheritdoc cref="ILikeDocument" />
76101 public class LikeDocumentDescriptor < TDocument > : DescriptorBase < LikeDocumentDescriptor < TDocument > , ILikeDocument > , ILikeDocument
77102 where TDocument : class
78103 {
79- private Routing _routing ;
80104
81105 public LikeDocumentDescriptor ( )
82106 {
@@ -85,39 +109,36 @@ public LikeDocumentDescriptor()
85109 }
86110
87111 object ILikeDocument . Document { get ; set ; }
88-
89112 Fields ILikeDocument . Fields { get ; set ; }
90113 Id ILikeDocument . Id { get ; set ; }
91114 IndexName ILikeDocument . Index { get ; set ; }
92115 IPerFieldAnalyzer ILikeDocument . PerFieldAnalyzer { get ; set ; }
93-
94- Routing ILikeDocument . Routing
95- {
96- get => _routing ?? ( Self . Document == null ? null : new Routing ( Self . Document ) ) ;
97- set => _routing = value ;
98- }
116+ Routing ILikeDocument . Routing { get ; set ; }
99117
100118 TypeName ILikeDocument . Type { get ; set ; }
101119
120+ /// <inheritdoc cref="ILikeDocument.Index" />
102121 public LikeDocumentDescriptor < TDocument > Index ( IndexName index ) => Assign ( index , ( a , v ) => a . Index = v ) ;
103122
104123 public LikeDocumentDescriptor < TDocument > Type ( TypeName type ) => Assign ( type , ( a , v ) => a . Type = v ) ;
105124
125+ /// <inheritdoc cref="ILikeDocument.Id" />
106126 public LikeDocumentDescriptor < TDocument > Id ( Id id ) => Assign ( id , ( a , v ) => a . Id = v ) ;
107127
128+ /// <inheritdoc cref="ILikeDocument.Routing" />
108129 public LikeDocumentDescriptor < TDocument > Routing ( Routing routing ) => Assign ( routing , ( a , v ) => a . Routing = v ) ;
109130
131+ /// <inheritdoc cref="ILikeDocument.Fields" />
110132 public LikeDocumentDescriptor < TDocument > Fields ( Func < FieldsDescriptor < TDocument > , IPromise < Fields > > fields ) =>
111133 Assign ( fields , ( a , v ) => a . Fields = v ? . Invoke ( new FieldsDescriptor < TDocument > ( ) ) ? . Value ) ;
112134
135+ /// <inheritdoc cref="ILikeDocument.Fields" />
113136 public LikeDocumentDescriptor < TDocument > Fields ( Fields fields ) => Assign ( fields , ( a , v ) => a . Fields = v ) ;
114137
115- public LikeDocumentDescriptor < TDocument > Document ( TDocument document ) => Assign ( document , ( a , v ) =>
116- {
117- a . Id = Infer . Id ( v ) ;
118- a . Document = v ;
119- } ) ;
138+ /// <inheritdoc cref="ILikeDocument.Document" />
139+ public LikeDocumentDescriptor < TDocument > Document ( TDocument document ) => Assign ( document , ( a , v ) => a . Document = v ) ;
120140
141+ /// <inheritdoc cref="ILikeDocument.PerFieldAnalyzer" />
121142 public LikeDocumentDescriptor < TDocument > PerFieldAnalyzer (
122143 Func < PerFieldAnalyzerDescriptor < TDocument > , IPromise < IPerFieldAnalyzer > > analyzerSelector
123144 ) =>
0 commit comments