1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the ONGR package. |
5
|
|
|
* |
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace ONGR\ElasticsearchDSL\Query\Span; |
13
|
|
|
|
14
|
|
|
use ONGR\ElasticsearchDSL\ParametersTrait; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Elasticsearch span containing query. |
18
|
|
|
* |
19
|
|
|
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-containing-query.html |
20
|
|
|
*/ |
21
|
|
|
class SpanContainingQuery implements SpanQueryInterface |
22
|
|
|
{ |
23
|
|
|
use ParametersTrait; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param SpanQueryInterface |
27
|
|
|
*/ |
28
|
|
|
private $big; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param SpanQueryInterface |
32
|
|
|
*/ |
33
|
|
|
private $little; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param SpanQueryInterface $little |
37
|
|
|
* @param SpanQueryInterface $big |
38
|
|
|
*/ |
39
|
|
|
public function __construct(SpanQueryInterface $little, SpanQueryInterface $big) |
40
|
|
|
{ |
41
|
|
|
$this->setLittle($little); |
42
|
|
|
$this->setBig($big); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return SpanQueryInterface |
47
|
|
|
*/ |
48
|
|
|
public function getBig() |
49
|
|
|
{ |
50
|
|
|
return $this->big; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param SpanQueryInterface $big |
55
|
|
|
*/ |
56
|
|
|
public function setBig(SpanQueryInterface $big) |
57
|
|
|
{ |
58
|
|
|
$this->big = $big; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return SpanQueryInterface |
63
|
|
|
*/ |
64
|
|
|
public function getLittle() |
65
|
|
|
{ |
66
|
|
|
return $this->little; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param SpanQueryInterface $little |
71
|
|
|
*/ |
72
|
|
|
public function setLittle(SpanQueryInterface $little) |
73
|
|
|
{ |
74
|
|
|
$this->little = $little; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* {@inheritdoc} |
79
|
|
|
*/ |
80
|
|
|
public function getType() |
81
|
|
|
{ |
82
|
|
|
return 'span_containing'; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* {@inheritdoc} |
87
|
|
|
*/ |
88
|
|
|
public function toArray() |
89
|
|
|
{ |
90
|
|
|
$out = [ |
91
|
|
|
'little' => $this->getLittle()->toArray(), |
92
|
|
|
'big' => $this->getBig()->toArray(), |
93
|
|
|
]; |
94
|
|
|
|
95
|
|
|
$out = $this->processArray($out); |
96
|
|
|
|
97
|
|
|
return [$this->getType() => $out]; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|