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
|
|
|
use ONGR\ElasticsearchDSL\ParametersTrait; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Elasticsearch span containing query. |
17
|
|
|
* |
18
|
|
|
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-containing-query.html |
19
|
|
|
*/ |
20
|
|
|
class SpanContainingQuery implements SpanQueryInterface |
21
|
|
|
{ |
22
|
|
|
use ParametersTrait; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param SpanQueryInterface |
26
|
|
|
*/ |
27
|
|
|
private $big; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param SpanQueryInterface |
31
|
|
|
*/ |
32
|
|
|
private $little; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param SpanQueryInterface $big |
36
|
|
|
* @param SpanQueryInterface $little |
37
|
|
|
*/ |
38
|
|
|
public function __construct(SpanQueryInterface $big, SpanQueryInterface $little) |
39
|
|
|
{ |
40
|
|
|
$this->setBig($big); |
41
|
|
|
$this->setLittle($little); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return SpanQueryInterface |
46
|
|
|
*/ |
47
|
|
|
public function getBig() |
48
|
|
|
{ |
49
|
|
|
return $this->big; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param SpanQueryInterface $big |
54
|
|
|
*/ |
55
|
|
|
public function setBig(SpanQueryInterface $big) |
56
|
|
|
{ |
57
|
|
|
$this->big = $big; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return SpanQueryInterface |
62
|
|
|
*/ |
63
|
|
|
public function getLittle() |
64
|
|
|
{ |
65
|
|
|
return $this->little; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param SpanQueryInterface $little |
70
|
|
|
*/ |
71
|
|
|
public function setLittle(SpanQueryInterface $little) |
72
|
|
|
{ |
73
|
|
|
$this->little = $little; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* {@inheritdoc} |
78
|
|
|
*/ |
79
|
|
|
public function getType() |
80
|
|
|
{ |
81
|
|
|
return 'span_containing'; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
|
|
public function toArray() |
88
|
|
|
{ |
89
|
|
|
$out = [ |
90
|
|
|
'little' => $this->getLittle()->toArray(), |
91
|
|
|
'big' => $this->getBig()->toArray(), |
92
|
|
|
]; |
93
|
|
|
|
94
|
|
|
return [$this->getType() => $out]; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|