File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ abstract class AbstractMatchQuery implements QueryInterface
11
11
12
12
public function __construct (
13
13
string $ field ,
14
- protected string $ query ,
14
+ protected string | bool | int $ query ,
15
15
protected ?string $ analyzer = null ,
16
16
protected array $ params = [],
17
17
) {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class MatchQuery extends AbstractMatchQuery
14
14
15
15
public function __construct (
16
16
string $ field ,
17
- string $ query ,
17
+ string | bool | int $ query ,
18
18
?string $ analyzer = null ,
19
19
?string $ operator = null ,
20
20
?string $ minimumShouldMatch = null ,
Original file line number Diff line number Diff line change @@ -38,4 +38,30 @@ public function testItBuildTheQueryWithAnAnalyzer(): void
38
38
],
39
39
], $ query ->build ());
40
40
}
41
+
42
+ public function testItBuildTheQueryWithBoolean (): void
43
+ {
44
+ $ query = new MatchQuery ('is_closed ' , true );
45
+ $ this ->assertSame ([
46
+ 'match ' => [
47
+ 'is_closed ' => [
48
+ 'query ' => true
49
+ ],
50
+ ],
51
+ ], $ query ->build ());
52
+ }
53
+
54
+
55
+ public function testItBuildTheQueryWithInteger (): void
56
+ {
57
+ $ query = new MatchQuery ('count ' , 1 );
58
+
59
+ $ this ->assertSame ([
60
+ 'match ' => [
61
+ 'count ' => [
62
+ 'query ' => 1
63
+ ],
64
+ ],
65
+ ], $ query ->build ());
66
+ }
41
67
}
You can’t perform that action at this time.
0 commit comments