File tree 2 files changed +22
-0
lines changed
lib/elasticsearch/dsl/search/queries
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ module Queries
36
36
class Bool
37
37
include BaseComponent
38
38
39
+ option_method :minimum_should_match
40
+ option_method :boost
41
+
39
42
def must ( *args , &block )
40
43
@hash [ name ] [ :must ] ||= [ ]
41
44
value = Query . new ( *args , &block ) . to_hash
Original file line number Diff line number Diff line change @@ -27,6 +27,25 @@ class BoolTest < ::Test::Unit::TestCase
27
27
assert_equal ( { bool : { must : [ { match : { foo : 'bar' } } ] } } , subject . to_hash )
28
28
end
29
29
30
+ should "have option methods" do
31
+ subject = Bool . new do
32
+ should { term tag : 'wow' }
33
+ should { term tag : 'elasticsearch' }
34
+
35
+ minimum_should_match 1
36
+ boost 1.0
37
+ end
38
+
39
+ assert_equal ( { bool :
40
+ {
41
+ minimum_should_match : 1 ,
42
+ boost : 1.0 ,
43
+ should : [ { term : { tag : 'wow' } } , { term : { tag : 'elasticsearch' } } ]
44
+ }
45
+ } ,
46
+ subject . to_hash )
47
+ end
48
+
30
49
should "take a block with multiple methods" do
31
50
subject = Bool . new do
32
51
must { match foo : 'bar' }
You can’t perform that action at this time.
0 commit comments