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 | * |
||
134 | * @throws InterruptException |
||
135 | * @throws TickDoesNotExistException |
||
136 | */ |
||
137 | private function updateRunner($action) { |
||
144 | |||
145 | |||
146 | /** |
||
147 | * @param $line |
||
148 | */ |
||
149 | private function outputRunner($line) { |
||
156 | |||
157 | |||
158 | /** |
||
159 | * Called when loading the platform. |
||
160 | * |
||
161 | * Loading some container and connect to ElasticSearch. |
||
162 | * |
||
163 | * @throws ConfigurationException |
||
164 | * @throws QueryException |
||
165 | * @throws Exception |
||
166 | */ |
||
167 | public function loadPlatform() { |
||
182 | |||
183 | |||
184 | /** |
||
185 | * not used yet. |
||
186 | * |
||
187 | * @return bool |
||
188 | * @throws ConfigurationException |
||
189 | */ |
||
190 | public function testPlatform() { |
||
193 | |||
194 | |||
195 | /** |
||
196 | * called before any index |
||
197 | * |
||
198 | * We create a general index. |
||
199 | * |
||
200 | * @throws ConfigurationException |
||
201 | * @throws BadRequest400Exception |
||
202 | */ |
||
203 | public function initializeIndex() { |
||
206 | |||
207 | |||
208 | /** |
||
209 | * resetIndex(); |
||
210 | * |
||
211 | * Called when admin wants to remove an index specific to a $provider. |
||
212 | * $provider can be null, meaning a reset of the whole index. |
||
213 | * |
||
214 | * @param string $providerId |
||
215 | * |
||
216 | * @throws ConfigurationException |
||
217 | */ |
||
218 | public function resetIndex($providerId) { |
||
225 | |||
226 | |||
227 | /** |
||
228 | * @param IFullTextSearchProvider $provider |
||
229 | * @param IndexDocument[] $documents |
||
230 | * |
||
231 | * @return Index[] |
||
232 | * @throws Exception |
||
233 | */ |
||
234 | public function indexDocuments(IFullTextSearchProvider $provider, $documents) { |
||
252 | |||
253 | |||
254 | /** |
||
255 | * @param IFullTextSearchProvider $provider |
||
256 | * @param IndexDocument $document |
||
257 | * |
||
258 | * @return Index |
||
259 | * @throws AccessIsEmptyException |
||
260 | * @throws ConfigurationException |
||
261 | * @throws InterruptException |
||
262 | * @throws TickDoesNotExistException |
||
263 | */ |
||
264 | public function indexDocument(IFullTextSearchProvider $provider, IndexDocument $document) { |
||
281 | |||
282 | |||
283 | /** |
||
284 | * @param IFullTextSearchProvider $provider |
||
285 | * @param IndexDocument $document |
||
286 | * @param Exception $e |
||
287 | * |
||
288 | * @return Index |
||
289 | * @throws ConfigurationException |
||
290 | * @throws AccessIsEmptyException |
||
291 | */ |
||
292 | private function indexDocumentError( |
||
310 | |||
311 | |||
312 | /** |
||
313 | * {@inheritdoc} |
||
314 | * @throws ConfigurationException |
||
315 | */ |
||
316 | public function deleteIndexes($indexes) { |
||
323 | |||
324 | |||
325 | /** |
||
326 | * {@inheritdoc} |
||
327 | * @throws ConfigurationException |
||
328 | * @throws Exception |
||
329 | */ |
||
330 | public function searchDocuments( |
||
335 | |||
336 | |||
337 | /** |
||
338 | * @param string $providerId |
||
339 | * @param string $documentId |
||
340 | * |
||
341 | * @return IndexDocument |
||
342 | */ |
||
343 | public function getDocument($providerId, $documentId) { |
||
346 | |||
347 | |||
348 | /** |
||
349 | * @param array $hosts |
||
350 | * |
||
351 | * @throws Exception |
||
352 | */ |
||
353 | private function connectToElastic($hosts) { |
||
374 | |||
375 | |||
376 | } |
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.