@@ -50,6 +50,9 @@ public interface IMatchQuery : IFieldNameQuery
50
50
[ JsonProperty ( PropertyName = "lenient" ) ]
51
51
bool ? Lenient { get ; set ; }
52
52
53
+ [ JsonProperty ( "minimum_should_match" ) ]
54
+ string MinimumShouldMatch { get ; set ; }
55
+
53
56
[ JsonProperty ( PropertyName = "operator" ) ]
54
57
[ JsonConverter ( typeof ( StringEnumConverter ) ) ]
55
58
Operator ? Operator { get ; set ; }
@@ -86,6 +89,7 @@ void IFieldNameQuery.SetFieldName(string fieldName)
86
89
public int ? Slop { get ; set ; }
87
90
public double ? Boost { get ; set ; }
88
91
public bool ? Lenient { get ; set ; }
92
+ public string MinimumShouldMatch { get ; set ; }
89
93
public Operator ? Operator { get ; set ; }
90
94
public PropertyPathMarker Field { get ; set ; }
91
95
}
@@ -96,12 +100,16 @@ public class MatchQueryDescriptor<T> : IMatchQuery where T : class
96
100
{
97
101
protected virtual string _type { get { return null ; } }
98
102
103
+ private IMatchQuery Self { get { return this ; } }
104
+
99
105
string IMatchQuery . Type { get { return _type ; } }
100
106
101
107
string IMatchQuery . Query { get ; set ; }
102
108
103
109
string IMatchQuery . Analyzer { get ; set ; }
104
110
111
+ string IMatchQuery . MinimumShouldMatch { get ; set ; }
112
+
105
113
RewriteMultiTerm ? IMatchQuery . Rewrite { get ; set ; }
106
114
107
115
double ? IMatchQuery . Fuzziness { get ; set ; }
@@ -126,85 +134,101 @@ bool IQuery.IsConditionless
126
134
{
127
135
get
128
136
{
129
- return ( ( IMatchQuery ) this ) . Field . IsConditionless ( ) || ( ( IMatchQuery ) this ) . Query . IsNullOrEmpty ( ) ;
137
+ return Self . Field . IsConditionless ( ) || Self . Query . IsNullOrEmpty ( ) ;
130
138
}
131
139
}
132
140
void IFieldNameQuery . SetFieldName ( string fieldName )
133
141
{
134
- ( ( IMatchQuery ) this ) . Field = fieldName ;
142
+ Self . Field = fieldName ;
135
143
}
136
144
PropertyPathMarker IFieldNameQuery . GetFieldName ( )
137
145
{
138
- return ( ( IMatchQuery ) this ) . Field ;
146
+ return Self . Field ;
139
147
}
140
148
141
149
public MatchQueryDescriptor < T > OnField ( string field )
142
150
{
143
- ( ( IMatchQuery ) this ) . Field = field ;
151
+ Self . Field = field ;
144
152
return this ;
145
153
}
154
+
146
155
public MatchQueryDescriptor < T > OnField ( Expression < Func < T , object > > objectPath )
147
156
{
148
- ( ( IMatchQuery ) this ) . Field = objectPath ;
157
+ Self . Field = objectPath ;
149
158
return this ;
150
159
}
151
160
152
161
public MatchQueryDescriptor < T > Query ( string query )
153
162
{
154
- ( ( IMatchQuery ) this ) . Query = query ;
163
+ Self . Query = query ;
155
164
return this ;
156
165
}
166
+
157
167
public MatchQueryDescriptor < T > Lenient ( bool lenient = true )
158
168
{
159
- ( ( IMatchQuery ) this ) . Lenient = lenient ;
169
+ Self . Lenient = lenient ;
160
170
return this ;
161
171
}
172
+
162
173
public MatchQueryDescriptor < T > Analyzer ( string analyzer )
163
174
{
164
- ( ( IMatchQuery ) this ) . Analyzer = analyzer ;
175
+ Self . Analyzer = analyzer ;
165
176
return this ;
166
177
}
178
+
167
179
public MatchQueryDescriptor < T > Fuzziness ( double fuzziness )
168
180
{
169
- ( ( IMatchQuery ) this ) . Fuzziness = fuzziness ;
181
+ Self . Fuzziness = fuzziness ;
170
182
return this ;
171
183
}
184
+
172
185
public MatchQueryDescriptor < T > CutoffFrequency ( double cutoffFrequency )
173
186
{
174
- ( ( IMatchQuery ) this ) . CutoffFrequency = cutoffFrequency ;
187
+ Self . CutoffFrequency = cutoffFrequency ;
175
188
return this ;
176
189
}
177
190
178
191
public MatchQueryDescriptor < T > Rewrite ( RewriteMultiTerm rewrite )
179
192
{
180
- ( ( IMatchQuery ) this ) . Rewrite = rewrite ;
193
+ Self . Rewrite = rewrite ;
181
194
return this ;
182
195
}
183
196
184
197
public MatchQueryDescriptor < T > Boost ( double boost )
185
198
{
186
- ( ( IMatchQuery ) this ) . Boost = boost ;
199
+ Self . Boost = boost ;
187
200
return this ;
188
201
}
202
+
189
203
public MatchQueryDescriptor < T > PrefixLength ( int prefixLength )
190
204
{
191
- ( ( IMatchQuery ) this ) . PrefixLength = prefixLength ;
205
+ Self . PrefixLength = prefixLength ;
192
206
return this ;
193
207
}
208
+
194
209
public MatchQueryDescriptor < T > MaxExpansions ( int maxExpansions )
195
210
{
196
- ( ( IMatchQuery ) this ) . MaxExpansions = maxExpansions ;
211
+ Self . MaxExpansions = maxExpansions ;
197
212
return this ;
198
213
}
214
+
199
215
public MatchQueryDescriptor < T > Slop ( int slop )
200
216
{
201
- ( ( IMatchQuery ) this ) . Slop = slop ;
217
+ Self . Slop = slop ;
218
+ return this ;
219
+ }
220
+
221
+ public MatchQueryDescriptor < T > MinimumShouldMatch ( string minimumShouldMatch )
222
+ {
223
+ Self . MinimumShouldMatch = minimumShouldMatch ;
202
224
return this ;
203
225
}
226
+
204
227
public MatchQueryDescriptor < T > Operator ( Operator op )
205
228
{
206
- ( ( IMatchQuery ) this ) . Operator = op ;
229
+ Self . Operator = op ;
207
230
return this ;
208
231
}
232
+
209
233
}
210
234
}
0 commit comments