1 | <?php |
||
52 | class ElasticSearchPlatform implements IFullTextSearchPlatform { |
||
53 | |||
54 | /** @var ConfigService */ |
||
55 | private $configService; |
||
56 | |||
57 | /** @var IndexService */ |
||
58 | private $indexService; |
||
59 | |||
60 | /** @var SearchService */ |
||
61 | private $searchService; |
||
62 | |||
63 | /** @var MiscService */ |
||
64 | private $miscService; |
||
65 | |||
66 | /** @var Client */ |
||
67 | private $client; |
||
68 | |||
69 | /** @var Runner */ |
||
70 | private $runner; |
||
71 | |||
72 | |||
73 | /** |
||
74 | * return a unique Id of the platform. |
||
75 | */ |
||
76 | public function getId() { |
||
79 | |||
80 | /** |
||
81 | * return a unique Id of the platform. |
||
82 | */ |
||
83 | public function getName() { |
||
86 | |||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getVersion() { |
||
94 | |||
95 | |||
96 | /** |
||
97 | * @return array |
||
|
|||
98 | * @throws ConfigurationException |
||
99 | */ |
||
100 | public function getConfiguration() { |
||
122 | |||
123 | |||
124 | /** |
||
125 | * @param Runner $runner |
||
126 | */ |
||
127 | public function setRunner(Runner $runner) { |
||
130 | |||
131 | /** |
||
132 | * @param $action |
||
133 | * @param bool $force |
||
134 | * |
||
135 | * @throws InterruptException |
||
136 | * @throws TickDoesNotExistException |
||
137 | */ |
||
138 | private function updateRunnerAction($action, $force = false) { |
||
145 | |||
146 | /** |
||
147 | * @param string $info |
||
148 | * @param string $value |
||
149 | * @param string $color |
||
150 | */ |
||
151 | private function updateRunnerInfo($info, $value, $color = '') { |
||
158 | |||
159 | /** |
||
160 | * @param array $data |
||
161 | */ |
||
162 | private function updateRunnerInfoArray($data) { |
||
169 | |||
170 | |||
171 | /** |
||
172 | * @param Index $index |
||
173 | * @param string $message |
||
174 | * @param string $exception |
||
175 | * @param int $sev |
||
176 | */ |
||
177 | private function updateNewIndexError($index, $message, $exception, $sev) { |
||
184 | |||
185 | |||
186 | /** |
||
187 | * Called when loading the platform. |
||
188 | * |
||
189 | * Loading some container and connect to ElasticSearch. |
||
190 | * |
||
191 | * @throws ConfigurationException |
||
192 | * @throws QueryException |
||
193 | * @throws Exception |
||
194 | */ |
||
195 | public function loadPlatform() { |
||
210 | |||
211 | |||
212 | /** |
||
213 | * not used yet. |
||
214 | * |
||
215 | * @return bool |
||
216 | * @throws ConfigurationException |
||
217 | */ |
||
218 | public function testPlatform() { |
||
221 | |||
222 | |||
223 | /** |
||
224 | * called before any index |
||
225 | * |
||
226 | * We create a general index. |
||
227 | * |
||
228 | * @throws ConfigurationException |
||
229 | * @throws BadRequest400Exception |
||
230 | */ |
||
231 | public function initializeIndex() { |
||
234 | |||
235 | |||
236 | /** |
||
237 | * resetIndex(); |
||
238 | * |
||
239 | * Called when admin wants to remove an index specific to a $provider. |
||
240 | * $provider can be null, meaning a reset of the whole index. |
||
241 | * |
||
242 | * @param string $providerId |
||
243 | * |
||
244 | * @throws ConfigurationException |
||
245 | */ |
||
246 | public function resetIndex($providerId) { |
||
253 | |||
254 | |||
255 | /** |
||
256 | * @deprecated |
||
257 | * @param IFullTextSearchProvider $provider |
||
258 | * @param $documents |
||
259 | */ |
||
260 | public function indexDocuments(IFullTextSearchProvider $provider, $documents) { |
||
263 | |||
264 | |||
265 | /** |
||
266 | * @param IFullTextSearchProvider $provider |
||
267 | * @param IndexDocument $document |
||
268 | * |
||
269 | * @return Index |
||
270 | * @throws AccessIsEmptyException |
||
271 | * @throws ConfigurationException |
||
272 | * @throws InterruptException |
||
273 | * @throws TickDoesNotExistException |
||
274 | */ |
||
275 | public function indexDocument(IFullTextSearchProvider $provider, IndexDocument $document) { |
||
314 | |||
315 | |||
316 | /** |
||
317 | * @param IFullTextSearchProvider $provider |
||
318 | * @param IndexDocument $document |
||
319 | * @param Exception $e |
||
320 | * |
||
321 | * @return Index |
||
322 | * @throws AccessIsEmptyException |
||
323 | * @throws ConfigurationException |
||
324 | * @throws InterruptException |
||
325 | * @throws TickDoesNotExistException |
||
326 | */ |
||
327 | private function indexDocumentError( |
||
345 | |||
346 | |||
347 | /** |
||
348 | * {@inheritdoc} |
||
349 | * @throws ConfigurationException |
||
350 | */ |
||
351 | public function deleteIndexes($indexes) { |
||
358 | |||
359 | |||
360 | /** |
||
361 | * {@inheritdoc} |
||
362 | * @throws ConfigurationException |
||
363 | * @throws Exception |
||
364 | */ |
||
365 | public function searchDocuments( |
||
370 | |||
371 | |||
372 | /** |
||
373 | * @param string $providerId |
||
374 | * @param string $documentId |
||
375 | * |
||
376 | * @return IndexDocument |
||
377 | * @throws ConfigurationException |
||
378 | */ |
||
379 | public function getDocument($providerId, $documentId) { |
||
382 | |||
383 | |||
384 | /** |
||
385 | * @param array $hosts |
||
386 | * |
||
387 | * @throws Exception |
||
388 | */ |
||
389 | private function connectToElastic($hosts) { |
||
410 | |||
411 | |||
412 | } |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.