function acquia_search_get_v3_client in Acquia Connector 8
Initializes and returns an instance of AcquiaSearchV3ApiClient.
Return value
\Drupal\acquia_search\AcquiaSearchV3ApiClient|false Acquia search V3 API Client or false on failure.
2 calls to acquia_search_get_v3_client()
- acquia_search_get_v3_cores in acquia_search/
acquia_search.module - Retrieves list of search v3 cores.
- SearchSubscriber::getSearchV3IndexKeys in acquia_search/
src/ EventSubscriber/ SearchSubscriber.php - Fetches the search v3 index keys.
File
- acquia_search/
acquia_search.module, line 662 - Integration between Acquia Drupal and Acquia's hosted solr search service.
Code
function acquia_search_get_v3_client() {
$search_v3_host = \Drupal::state()
->get('acquia_search.v3_api_host') ? \Drupal::state()
->get('acquia_search.v3_api_host') : 'https://api.sr.acquia.com';
$search_v3_api_key = \Drupal::state()
->get('acquia_search.v3_api_key');
$drupal_http_client = \Drupal::service('http_client');
$cache = \Drupal::cache();
// If any of these variables are empty return FALSE.
if (empty($search_v3_host) || empty($search_v3_api_key)) {
return FALSE;
}
return new AcquiaSearchV3ApiClient($search_v3_host, $search_v3_api_key, $drupal_http_client, $cache);
}