1 | <?php |
||
22 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html |
||
23 | */ |
||
24 | class MatchQuery implements BuilderInterface |
||
25 | { |
||
26 | use ParametersTrait; |
||
27 | |||
28 | public function __construct( |
||
29 | private string $field, |
||
|
|||
30 | private string $query, |
||
31 | array $parameters = [] |
||
32 | ) { |
||
33 | $this->setParameters($parameters); |
||
34 | } |
||
35 | |||
36 | public function getType(): string |
||
37 | { |
||
38 | return 'match'; |
||
39 | } |
||
40 | |||
41 | public function toArray(): array |
||
42 | { |
||
43 | $query = [ |
||
44 | 'query' => $this->query, |
||
45 | ]; |
||
46 | |||
47 | $output = [ |
||
48 | $this->field => $this->processArray($query), |
||
49 | ]; |
||
50 | |||
51 | return [$this->getType() => $output]; |
||
52 | } |
||
53 | } |
||
54 |