File tree 2 files changed +32
-0
lines changed 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,10 @@ class SpanWithin(Query):
355
355
356
356
357
357
# core queries
358
+ class CombinedFields (Query ):
359
+ name = "combined_fields"
360
+
361
+
358
362
class Common (Query ):
359
363
name = "common"
360
364
Original file line number Diff line number Diff line change @@ -27,6 +27,34 @@ def test_empty_Q_is_match_all():
27
27
assert query .MatchAll () == q
28
28
29
29
30
+ def test_combined_fields_to_dict ():
31
+ assert {
32
+ "combined_fields" : {
33
+ "query" : "this is a test" ,
34
+ "fields" : ["name" , "body" , "description" ],
35
+ "operator" : "and" ,
36
+ },
37
+ } == query .CombinedFields (
38
+ query = "this is a test" ,
39
+ fields = ["name" , "body" , "description" ],
40
+ operator = "and" ,
41
+ ).to_dict ()
42
+
43
+
44
+ def test_combined_fields_to_dict_extra ():
45
+ assert {
46
+ "combined_fields" : {
47
+ "query" : "this is a test" ,
48
+ "fields" : ["name" , "body^2" ],
49
+ "operator" : "or" ,
50
+ },
51
+ } == query .CombinedFields (
52
+ query = "this is a test" ,
53
+ fields = ["name" , "body^2" ],
54
+ operator = "or" ,
55
+ ).to_dict ()
56
+
57
+
30
58
def test_match_to_dict ():
31
59
assert {"match" : {"f" : "value" }} == query .Match (f = "value" ).to_dict ()
32
60
You can’t perform that action at this time.
0 commit comments