1 | <?php |
||
51 | class ElasticSearchPlatform implements IFullTextSearchPlatform { |
||
52 | |||
53 | /** @var ConfigService */ |
||
54 | private $configService; |
||
55 | |||
56 | /** @var IndexService */ |
||
57 | private $indexService; |
||
58 | |||
59 | /** @var SearchService */ |
||
60 | private $searchService; |
||
61 | |||
62 | /** @var MiscService */ |
||
63 | private $miscService; |
||
64 | |||
65 | /** @var Client */ |
||
66 | private $client; |
||
67 | |||
68 | /** @var Runner */ |
||
69 | private $runner; |
||
70 | |||
71 | |||
72 | /** |
||
73 | * return a unique Id of the platform. |
||
74 | */ |
||
75 | public function getId() { |
||
78 | |||
79 | /** |
||
80 | * return a unique Id of the platform. |
||
81 | */ |
||
82 | public function getName() { |
||
85 | |||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getVersion() { |
||
93 | |||
94 | // public function getClient() { |
||
|
|||
95 | // return $this->client; |
||
96 | // } |
||
97 | |||
98 | |||
99 | /** |
||
100 | * @param Runner $runner |
||
101 | */ |
||
102 | public function setRunner(Runner $runner) { |
||
105 | |||
106 | /** |
||
107 | * @param $action |
||
108 | * |
||
109 | * @throws InterruptException |
||
110 | * @throws TickDoesNotExistException |
||
111 | */ |
||
112 | private function updateRunner($action) { |
||
119 | |||
120 | |||
121 | /** |
||
122 | * @param $line |
||
123 | */ |
||
124 | private function outputRunner($line) { |
||
131 | |||
132 | |||
133 | /** |
||
134 | * Called when loading the platform. |
||
135 | * |
||
136 | * Loading some container and connect to ElasticSearch. |
||
137 | * |
||
138 | * @throws ConfigurationException |
||
139 | * @throws QueryException |
||
140 | */ |
||
141 | public function loadPlatform() { |
||
156 | |||
157 | |||
158 | /** |
||
159 | * not used yet. |
||
160 | */ |
||
161 | public function testPlatform() { |
||
163 | |||
164 | |||
165 | /** |
||
166 | * called before any index |
||
167 | * |
||
168 | * We create a general index. |
||
169 | * |
||
170 | * @param IFullTextSearchProvider $provider |
||
171 | * |
||
172 | * @throws ConfigurationException |
||
173 | */ |
||
174 | public function initializeIndex(IFullTextSearchProvider $provider) { |
||
179 | |||
180 | |||
181 | /** |
||
182 | * resetIndex(); |
||
183 | * |
||
184 | * Called when admin wants to remove an index specific to a $provider. |
||
185 | * $provider can be null, meaning a reset of the whole index. |
||
186 | * |
||
187 | * @param IFullTextSearchProvider|null $provider |
||
188 | * |
||
189 | * @throws ConfigurationException |
||
190 | */ |
||
191 | public function resetIndex($provider) { |
||
201 | |||
202 | |||
203 | /** |
||
204 | * {@inheritdoc} |
||
205 | */ |
||
206 | public function indexDocuments(IFullTextSearchProvider $provider, $documents) { |
||
217 | |||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | public function indexDocument(IFullTextSearchProvider $provider, IndexDocument $document) { |
||
237 | |||
238 | |||
239 | /** |
||
240 | * @param IFullTextSearchProvider $provider |
||
241 | * @param IndexDocument $document |
||
242 | * @param Exception $e |
||
243 | * |
||
244 | * @return Index |
||
245 | * @throws ConfigurationException |
||
246 | */ |
||
247 | private function indexDocumentError( |
||
265 | |||
266 | |||
267 | /** |
||
268 | * {@inheritdoc} |
||
269 | */ |
||
270 | public function deleteIndexes($indexes) { |
||
277 | |||
278 | |||
279 | /** |
||
280 | * {@inheritdoc} |
||
281 | */ |
||
282 | public function searchDocuments(IFullTextSearchProvider $provider, DocumentAccess $access, $request |
||
292 | |||
293 | |||
294 | /** |
||
295 | * @param string $host |
||
296 | */ |
||
297 | private function connectToElastic($host) { |
||
316 | |||
317 | |||
318 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.