@@ -33,6 +33,8 @@ public MultiGetOperation(long id) : this(id.ToString(CultureInfo.InvariantCultur
3333 public string Routing { get ; set ; }
3434
3535 public object Document { get ; set ; }
36+
37+ public IDictionary < PropertyPathMarker , string > PerFieldAnalyzer { get ; set ; }
3638 }
3739
3840 public class MultiGetOperationDescriptor < T > : IMultiGetOperation
@@ -47,6 +49,7 @@ public class MultiGetOperationDescriptor<T> : IMultiGetOperation
4749 ISourceFilter IMultiGetOperation . Source { get ; set ; }
4850 IList < PropertyPathMarker > IMultiGetOperation . Fields { get ; set ; }
4951 object IMultiGetOperation . Document { get ; set ; }
52+ IDictionary < PropertyPathMarker , string > IMultiGetOperation . PerFieldAnalyzer { get ; set ; }
5053 Type IMultiGetOperation . ClrType { get { return typeof ( T ) ; } }
5154
5255 public MultiGetOperationDescriptor ( )
@@ -63,7 +66,8 @@ public MultiGetOperationDescriptor()
6366 /// </pre>
6467 /// </summary>
6568 /// <param name="initializeEmpty"></param>
66- public MultiGetOperationDescriptor ( bool allowExplicitIndex ) : this ( )
69+ public MultiGetOperationDescriptor ( bool allowExplicitIndex )
70+ : this ( )
6771 {
6872 if ( allowExplicitIndex ) return ;
6973 Self . Index = null ;
@@ -89,7 +93,7 @@ public MultiGetOperationDescriptor<T> Type(string type)
8993 return this ;
9094 }
9195
92-
96+
9397 /// <summary>
9498 /// Manually set the type of which a typename will be inferred
9599 /// </summary>
@@ -144,7 +148,7 @@ public MultiGetOperationDescriptor<T> Routing(string routing)
144148 /// </summary>
145149 public MultiGetOperationDescriptor < T > Fields ( params Expression < Func < T , object > > [ ] expressions )
146150 {
147- Self . Fields = expressions . Select ( e => ( PropertyPathMarker ) e ) . ToList ( ) ;
151+ Self . Fields = expressions . Select ( e => ( PropertyPathMarker ) e ) . ToList ( ) ;
148152 return this ;
149153 }
150154
@@ -154,7 +158,7 @@ public MultiGetOperationDescriptor<T> Fields(params Expression<Func<T, object>>[
154158 /// </summary>
155159 public MultiGetOperationDescriptor < T > Fields ( params string [ ] fields )
156160 {
157- Self . Fields = fields . Select ( f => ( PropertyPathMarker ) f ) . ToList ( ) ;
161+ Self . Fields = fields . Select ( f => ( PropertyPathMarker ) f ) . ToList ( ) ;
158162 return this ;
159163 }
160164
@@ -166,5 +170,27 @@ public MultiGetOperationDescriptor<T> Document(T document)
166170 Self . Document = document ;
167171 return this ;
168172 }
173+
174+ // Only used for the MLT query for providing a different analyzer per
175+ // artificial document field.
176+ // TODO: For 2.0, we should consider decoupling IMultiGetOperation from
177+ // MoreLikeThisQuery and have a dedicatd MoreLikeThisDocument object.
178+ public MultiGetOperationDescriptor < T > PerFieldAnalyzer ( Func < FluentDictionary < Expression < Func < T , object > > , string > , FluentDictionary < Expression < Func < T , object > > , string > > analyzerSelector )
179+ {
180+ var d = new FluentDictionary < Expression < Func < T , object > > , string > ( ) ;
181+ analyzerSelector ( d ) ;
182+ Self . PerFieldAnalyzer = d . ToDictionary ( x => PropertyPathMarker . Create ( x . Key ) , x => x . Value ) ;
183+ return this ;
184+ }
185+
186+ // Only used for the MLT query for providing a different analyzer per
187+ // artificial document field.
188+ // TODO: For 2.0, we should consider decoupling IMultiGetOperation from
189+ // MoreLikeThisQuery and have a dedicatd MoreLikeThisDocument object.
190+ public MultiGetOperationDescriptor < T > PerFieldAnalyzer ( Func < FluentDictionary < PropertyPathMarker , string > , FluentDictionary < PropertyPathMarker , string > > analyzerSelector )
191+ {
192+ Self . PerFieldAnalyzer = analyzerSelector ( new FluentDictionary < PropertyPathMarker , string > ( ) ) ;
193+ return this ;
194+ }
169195 }
170196}
0 commit comments