1 | <?php |
||
19 | class Search |
||
20 | { |
||
21 | /** |
||
22 | * @var Index $index |
||
23 | */ |
||
24 | protected $index; |
||
25 | |||
26 | /** |
||
27 | * @var Query $query |
||
28 | */ |
||
29 | protected $query; |
||
30 | |||
31 | /** |
||
32 | * @var string|boolean $path |
||
33 | */ |
||
34 | private $path; |
||
35 | |||
36 | /** |
||
37 | * @var int $limit |
||
38 | */ |
||
39 | private $limit = 25; |
||
40 | |||
41 | /** |
||
42 | * @var Boolean |
||
43 | */ |
||
44 | private static $boolean; |
||
45 | |||
46 | /** |
||
47 | * Search constructor. |
||
48 | * |
||
49 | * @param Index $index |
||
50 | * @param Query $query |
||
51 | */ |
||
52 | 31 | public function __construct(Index $index, Query $query) |
|
58 | |||
59 | /** |
||
60 | * @param $name |
||
61 | * @param $arguments |
||
62 | * @return $this |
||
63 | * @throws \BadMethodCallException |
||
64 | */ |
||
65 | 2 | public function __call($name, $arguments) |
|
74 | |||
75 | /** |
||
76 | * @param $limit |
||
77 | * @return $this |
||
78 | */ |
||
79 | 1 | public function limit($limit) |
|
84 | |||
85 | /** |
||
86 | * @param bool|string $path |
||
87 | * @return $this |
||
88 | */ |
||
89 | 21 | public function path($path = false) |
|
94 | |||
95 | /** |
||
96 | * @param $string |
||
97 | * @return $this |
||
98 | */ |
||
99 | 1 | public function raw($string) |
|
104 | |||
105 | /** |
||
106 | * @param $string |
||
107 | * @param null|string $field |
||
108 | * @param null $offsets |
||
109 | * @return $this |
||
110 | * @return $this |
||
111 | */ |
||
112 | 2 | public function phrase($string, $field = null, $offsets = null) |
|
117 | |||
118 | /** |
||
119 | * @param $string |
||
120 | * @param null|string $field |
||
121 | * @return $this |
||
122 | */ |
||
123 | 1 | public function fuzzy($string, $field = null) |
|
128 | |||
129 | /** |
||
130 | * @param $string |
||
131 | * @param null|string $field |
||
132 | * @return Term |
||
133 | */ |
||
134 | 4 | protected function indexTerm($string, $field = null) |
|
138 | |||
139 | /** |
||
140 | * @param $string |
||
141 | * @param null|string $field |
||
142 | * @return $this |
||
143 | */ |
||
144 | 1 | public function wildcard($string, $field = null) |
|
149 | |||
150 | /** |
||
151 | * Where |
||
152 | * |
||
153 | * A helper method to access phrase or to pass multiple fields. Phrase doesn't "match" exactly and |
||
154 | * allows searching within the text field rather than matching the whole string. |
||
155 | * |
||
156 | * @param boolean|$string |
||
157 | * @param null|string $field |
||
158 | * @return $this|bool |
||
159 | */ |
||
160 | 2 | public function where($string, $field = null) |
|
168 | |||
169 | /** |
||
170 | * Match |
||
171 | * |
||
172 | * Provides an exact pattern match. |
||
173 | * |
||
174 | * @param $string |
||
175 | * @param null $field |
||
176 | * @return $this |
||
177 | */ |
||
178 | 2 | public function match($string, $field = null) |
|
183 | |||
184 | /** |
||
185 | * @param array $terms |
||
186 | * @return $this |
||
187 | */ |
||
188 | 1 | public function multiTerm(array $terms) |
|
199 | |||
200 | /** |
||
201 | * @param string $string |
||
202 | * @param array $array |
||
203 | * @return mixed |
||
204 | */ |
||
205 | 1 | private function mapWhereArray($string, array $array) |
|
214 | |||
215 | /** |
||
216 | * @param string $string |
||
217 | * @param string|null $field |
||
218 | * @return QueryTerm |
||
219 | */ |
||
220 | 3 | public function term($string, $field = null) |
|
224 | |||
225 | /** |
||
226 | * @return mixed |
||
227 | */ |
||
228 | 2 | public function hits() |
|
234 | |||
235 | /** |
||
236 | * @param array|QueryHit $array |
||
237 | * @return mixed |
||
238 | */ |
||
239 | 3 | private function mapIds($array) |
|
248 | |||
249 | /** |
||
250 | * @return mixed |
||
251 | */ |
||
252 | 1 | public static function getLastQuery() |
|
256 | } |
||
257 |