1
|
|
|
<?php |
2
|
|
|
namespace Triadev\Leopard\Business\Dsl; |
3
|
|
|
|
4
|
|
|
use Triadev\Leopard\Busines\Dsl\Query\Specialized; |
5
|
|
|
use Triadev\Leopard\Business\Dsl\Query\Compound; |
6
|
|
|
use Triadev\Leopard\Business\Dsl\Query\Fulltext; |
7
|
|
|
use Triadev\Leopard\Business\Dsl\Query\Geo; |
8
|
|
|
use Triadev\Leopard\Business\Dsl\Query\InnerHit; |
9
|
|
|
use Triadev\Leopard\Business\Dsl\Query\Joining; |
10
|
|
|
use Triadev\Leopard\Business\Dsl\Query\TermLevel; |
11
|
|
|
|
12
|
|
|
class Search extends AbstractQuery |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Aggregation |
16
|
|
|
* |
17
|
|
|
* @param \Closure $aggregation |
18
|
|
|
* @return Search |
19
|
|
|
*/ |
20
|
1 |
|
public function aggregation(\Closure $aggregation) : Search |
21
|
|
|
{ |
22
|
1 |
|
$aggregation(new Aggregation($this->search)); |
23
|
1 |
|
return $this; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Term level |
28
|
|
|
* |
29
|
|
|
* @return TermLevel |
30
|
|
|
*/ |
31
|
22 |
|
public function termLevel() : TermLevel |
32
|
|
|
{ |
33
|
22 |
|
return new TermLevel($this->search, $this->model); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Fulltext |
38
|
|
|
* |
39
|
|
|
* @return Fulltext |
40
|
|
|
*/ |
41
|
2 |
|
public function fulltext() : Fulltext |
42
|
|
|
{ |
43
|
2 |
|
return new Fulltext($this->search, $this->model); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Geo |
48
|
|
|
* |
49
|
|
|
* @return Geo |
50
|
|
|
*/ |
51
|
1 |
|
public function geo() : Geo |
52
|
|
|
{ |
53
|
1 |
|
return new Geo($this->search, $this->model); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Compound |
58
|
|
|
* |
59
|
|
|
* @return Compound |
60
|
|
|
*/ |
61
|
7 |
|
public function compound() : Compound |
62
|
|
|
{ |
63
|
7 |
|
return new Compound($this->search, $this->model); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Joining |
68
|
|
|
* |
69
|
|
|
* @return Joining |
70
|
|
|
*/ |
71
|
1 |
|
public function joining() : Joining |
72
|
|
|
{ |
73
|
1 |
|
return new Joining($this->search, $this->model); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Specialized |
78
|
|
|
* |
79
|
|
|
* @return Specialized |
80
|
|
|
*/ |
81
|
1 |
|
public function specialized() : Specialized |
82
|
|
|
{ |
83
|
1 |
|
return new Specialized($this->search, $this->model); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Inner hit |
88
|
|
|
* |
89
|
|
|
* @return InnerHit |
90
|
|
|
*/ |
91
|
1 |
|
public function innerHit() : InnerHit |
92
|
|
|
{ |
93
|
1 |
|
return new InnerHit($this->search, $this->model); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|