|
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 $little; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param SpanQueryInterface |
|
32
|
|
|
*/ |
|
33
|
|
|
private $big; |
|
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 getLittle() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->little; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param SpanQueryInterface $little |
|
55
|
|
|
* |
|
56
|
|
|
* @return $this |
|
57
|
|
|
*/ |
|
58
|
|
|
public function setLittle(SpanQueryInterface $little) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->little = $little; |
|
61
|
|
|
|
|
62
|
|
|
return $this; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return SpanQueryInterface |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getBig() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->big; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param SpanQueryInterface $big |
|
75
|
|
|
* |
|
76
|
|
|
* @return $this |
|
77
|
|
|
*/ |
|
78
|
|
|
public function setBig(SpanQueryInterface $big) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->big = $big; |
|
81
|
|
|
|
|
82
|
|
|
return $this; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* {@inheritdoc} |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getType() |
|
89
|
|
|
{ |
|
90
|
|
|
return 'span_containing'; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* {@inheritdoc} |
|
95
|
|
|
*/ |
|
96
|
|
|
public function toArray() |
|
97
|
|
|
{ |
|
98
|
|
|
$output = [ |
|
99
|
|
|
'little' => $this->getLittle()->toArray(), |
|
100
|
|
|
'big' => $this->getBig()->toArray(), |
|
101
|
|
|
]; |
|
102
|
|
|
|
|
103
|
|
|
$output = $this->processArray($output); |
|
104
|
|
|
|
|
105
|
|
|
return [$this->getType() => $output]; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|