public function SearchApiAlgoliaBackend::listIndexes 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::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 594
Class
- SearchApiAlgoliaBackend
- Class SearchApiAlgoliaBackend.
Namespace
Drupal\search_api_algolia\Plugin\search_api\backendCode
public function listIndexes() {
$algoliaClient = SearchClient::create($this
->getApplicationId(), $this
->getApiKey());
$indexes = $algoliaClient
->listIndices();
$indexes_list = [];
if (isset($indexes['items'])) {
foreach ($indexes['items'] as $index) {
$indexes_list[$index['name']] = $index['name'];
}
}
return $indexes_list;
}