File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Tests/Nest.Tests.Unit/QueryParsers/Queries Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3+ using System . Globalization ;
34using System . Linq ;
45using Nest . Resolvers . Converters ;
56using Newtonsoft . Json ;
@@ -164,6 +165,12 @@ public SimpleQueryStringQueryDescriptor<T> Locale(string locale)
164165 return this ;
165166 }
166167
168+ public SimpleQueryStringQueryDescriptor < T > MinimumShouldMatch ( int minimumShouldMatches )
169+ {
170+ ( ( ISimpleQueryStringQuery ) this ) . MinimumShouldMatch = minimumShouldMatches . ToString ( CultureInfo . InvariantCulture ) ;
171+ return this ;
172+ }
173+
167174 public SimpleQueryStringQueryDescriptor < T > MinimumShouldMatch ( string minimumShouldMatch )
168175 {
169176 Self . MinimumShouldMatch = minimumShouldMatch ;
Original file line number Diff line number Diff line change @@ -33,5 +33,33 @@ public void SimpleQueryString_Deserializes()
3333 q . Query . Should ( ) . Be ( "some query" ) ;
3434 q . MinimumShouldMatch . Should ( ) . Be ( "50%" ) ;
3535 }
36+
37+ [ Test ]
38+ public void SimpleQueryString_MinimumShouldMatch_Deserializes ( )
39+ {
40+ var q = this . SerializeThenDeserialize (
41+ f => f . SimpleQueryString ,
42+ f => f . SimpleQueryString ( sq => sq
43+ . Analyzer ( "my-analyzer" )
44+ . DefaultOperator ( Operator . And )
45+ . Flags ( "ASFAS" )
46+ . Locale ( "en" )
47+ . LowercaseExpendedTerms ( )
48+ . DefaultField ( p => p . Name )
49+ . OnFields ( p => p . Name , p => p . Origin )
50+ . Query ( "some query" )
51+ . MinimumShouldMatch ( 50 )
52+ )
53+ ) ;
54+ q . Analyzer . Should ( ) . Be ( "my-analyzer" ) ;
55+ q . DefaultOperator . Should ( ) . Be ( Operator . And ) ;
56+ q . Flags . Should ( ) . Be ( "ASFAS" ) ;
57+ q . Locale . Should ( ) . Be ( "en" ) ;
58+ q . LowercaseExpendedTerms . Should ( ) . BeTrue ( ) ;
59+ q . DefaultField . Should ( ) . Be ( "name" ) ;
60+ q . Fields . Should ( ) . BeEquivalentTo ( new [ ] { "name" , "origin" } ) ;
61+ q . Query . Should ( ) . Be ( "some query" ) ;
62+ q . MinimumShouldMatch . Should ( ) . Be ( "50" ) ;
63+ }
3664 }
3765}
You can’t perform that action at this time.
0 commit comments