@@ 22-70 (lines=49) @@ | ||
19 | * |
|
20 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html |
|
21 | */ |
|
22 | class HasChildQuery implements BuilderInterface |
|
23 | { |
|
24 | use ParametersTrait; |
|
25 | ||
26 | /** |
|
27 | * @var string |
|
28 | */ |
|
29 | private $type; |
|
30 | ||
31 | /** |
|
32 | * @var BuilderInterface |
|
33 | */ |
|
34 | private $query; |
|
35 | ||
36 | /** |
|
37 | * @param string $type |
|
38 | * @param BuilderInterface $query |
|
39 | * @param array $parameters |
|
40 | */ |
|
41 | public function __construct($type, BuilderInterface $query, array $parameters = []) |
|
42 | { |
|
43 | $this->type = $type; |
|
44 | $this->query = $query; |
|
45 | $this->setParameters($parameters); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * {@inheritdoc} |
|
50 | */ |
|
51 | public function getType() |
|
52 | { |
|
53 | return 'has_child'; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * {@inheritdoc} |
|
58 | */ |
|
59 | public function toArray() |
|
60 | { |
|
61 | $query = [ |
|
62 | 'type' => $this->type, |
|
63 | 'query' => $this->query->toArray(), |
|
64 | ]; |
|
65 | ||
66 | $output = $this->processArray($query); |
|
67 | ||
68 | return [$this->getType() => $output]; |
|
69 | } |
|
70 | } |
|
71 |
@@ 22-70 (lines=49) @@ | ||
19 | * |
|
20 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-query.html |
|
21 | */ |
|
22 | class HasParentQuery implements BuilderInterface |
|
23 | { |
|
24 | use ParametersTrait; |
|
25 | ||
26 | /** |
|
27 | * @var string |
|
28 | */ |
|
29 | private $parentType; |
|
30 | ||
31 | /** |
|
32 | * @var BuilderInterface |
|
33 | */ |
|
34 | private $query; |
|
35 | ||
36 | /** |
|
37 | * @param string $parentType |
|
38 | * @param BuilderInterface $query |
|
39 | * @param array $parameters |
|
40 | */ |
|
41 | public function __construct($parentType, BuilderInterface $query, array $parameters = []) |
|
42 | { |
|
43 | $this->parentType = $parentType; |
|
44 | $this->query = $query; |
|
45 | $this->setParameters($parameters); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * {@inheritdoc} |
|
50 | */ |
|
51 | public function getType() |
|
52 | { |
|
53 | return 'has_parent'; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * {@inheritdoc} |
|
58 | */ |
|
59 | public function toArray() |
|
60 | { |
|
61 | $query = [ |
|
62 | 'parent_type' => $this->parentType, |
|
63 | 'query' => $this->query->toArray(), |
|
64 | ]; |
|
65 | ||
66 | $output = $this->processArray($query); |
|
67 | ||
68 | return [$this->getType() => $output]; |
|
69 | } |
|
70 | } |
|
71 |
@@ 21-67 (lines=47) @@ | ||
18 | * |
|
19 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-not-query.html |
|
20 | */ |
|
21 | class SpanNotQuery implements SpanQueryInterface |
|
22 | { |
|
23 | use ParametersTrait; |
|
24 | ||
25 | /** |
|
26 | * @var SpanQueryInterface |
|
27 | */ |
|
28 | private $include; |
|
29 | ||
30 | /** |
|
31 | * @var SpanQueryInterface |
|
32 | */ |
|
33 | private $exclude; |
|
34 | ||
35 | /** |
|
36 | * @param SpanQueryInterface $include |
|
37 | * @param SpanQueryInterface $exclude |
|
38 | * @param array $parameters |
|
39 | */ |
|
40 | public function __construct(SpanQueryInterface $include, SpanQueryInterface $exclude, array $parameters = []) |
|
41 | { |
|
42 | $this->include = $include; |
|
43 | $this->exclude = $exclude; |
|
44 | $this->setParameters($parameters); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * {@inheritdoc} |
|
49 | */ |
|
50 | public function getType() |
|
51 | { |
|
52 | return 'span_not'; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * {@inheritdoc} |
|
57 | */ |
|
58 | public function toArray() |
|
59 | { |
|
60 | $query = [ |
|
61 | 'include' => $this->include->toArray(), |
|
62 | 'exclude' => $this->exclude->toArray(), |
|
63 | ]; |
|
64 | ||
65 | return [$this->getType() => $this->processArray($query)]; |
|
66 | } |
|
67 | } |
|
68 |