public function SearchApiAlgoliaBackend::listIndexes in Search API Algolia 8
Same name and namespace in other branches
- 3.0.x src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::listIndexes()
- 2.0.x src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::listIndexes()
Retrieves the list of available Algolia indexes.
Return value
array List of indexes on Algolia.
File
- src/
Plugin/ search_api/ backend/ SearchApiAlgoliaBackend.php, line 521
Class
- SearchApiAlgoliaBackend
- Class SearchApiAlgoliaBackend.
Namespace
Drupal\search_api_algolia\Plugin\search_api\backendCode
public function listIndexes() {
$algoliaClient = new Client($this
->getApplicationId(), $this
->getApiKey());
$indexes = $algoliaClient
->listIndexes();
$indexes_list = [];
if (isset($indexes['items'])) {
foreach ($indexes['items'] as $index) {
$indexes_list[$index['name']] = $index['name'];
}
}
return $indexes_list;
}