1 | <?php |
||
21 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-field-masking-query.html |
||
22 | */ |
||
23 | class FieldMaskingSpanQuery implements SpanQueryInterface |
||
24 | { |
||
25 | use ParametersTrait; |
||
26 | |||
27 | public function __construct( |
||
28 | private string $field, |
||
|
|||
29 | private SpanQueryInterface $query |
||
30 | ) { |
||
31 | $this->setQuery($query); |
||
32 | $this->setField($field); |
||
33 | } |
||
34 | |||
35 | public function getQuery(): SpanQueryInterface |
||
36 | { |
||
37 | return $this->query; |
||
38 | } |
||
39 | |||
40 | public function setQuery(SpanQueryInterface $query): static |
||
41 | { |
||
42 | $this->query = $query; |
||
43 | |||
44 | return $this; |
||
45 | } |
||
46 | |||
47 | public function getField(): string |
||
48 | { |
||
49 | return $this->field; |
||
50 | } |
||
51 | |||
52 | public function setField(string $field): static |
||
53 | { |
||
54 | $this->field = $field; |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | |||
59 | public function toArray(): array |
||
60 | { |
||
61 | $output = [ |
||
62 | 'query' => $this->getQuery()->toArray(), |
||
63 | 'field' => $this->getField(), |
||
64 | ]; |
||
65 | |||
66 | $output = $this->processArray($output); |
||
67 | |||
68 | return [$this->getType() => $output]; |
||
69 | } |
||
70 | |||
71 | public function getType(): string |
||
72 | { |
||
73 | return 'field_masking_span'; |
||
74 | } |
||
75 | } |
||
76 |