public function SearchApiAlgoliaBackend::deleteAllIndexItems in Search API Algolia 3.0.x
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::deleteAllIndexItems()
- 2.0.x src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::deleteAllIndexItems()
1 call to SearchApiAlgoliaBackend::deleteAllIndexItems()
- SearchApiAlgoliaBackend::removeIndex in src/
Plugin/ search_api/ backend/ SearchApiAlgoliaBackend.php
File
- src/
Plugin/ search_api/ backend/ SearchApiAlgoliaBackend.php, line 437
Class
- SearchApiAlgoliaBackend
- Class SearchApiAlgoliaBackend.
Namespace
Drupal\search_api_algolia\Plugin\search_api\backendCode
public function deleteAllIndexItems(IndexInterface $index = NULL, $datasource_id = NULL) {
if (empty($index)) {
return;
}
foreach ($this
->getLanguages($index) as $key) {
// Connect to the Algolia service.
$this
->connect($index, '', $key);
// Clearing the full index.
$response = $this
->getAlgoliaIndex()
->clearObjects();
if ($this
->isDebugActive()) {
$this
->getLogger()
->notice('Deletion requested for full index on Algolia Index: @index, Response: @response.', [
'@response' => json_encode($response),
'@index' => $this
->getAlgoliaIndex()
->getIndexName(),
]);
}
// Wait for the deletion to be completed.
if ($this
->shouldWaitForDeleteToFinish()) {
$response
->wait();
}
}
}