public function SearchApiAcquiaApi::getPreferredCoreService in Acquia Search for Search API 7.2
Returns preferred search index service.
Return value
\SearchApiAcquiaPreferredCore Preferred search index service.
File
- includes/
v3/ SearchApiAcquiaApi.php, line 169
Class
- SearchApiAcquiaApi
- Class SearchApiAcquiaApi.
Code
public function getPreferredCoreService() {
$ah_env = $_SERVER['AH_SITE_ENVIRONMENT'] ?? '';
global $databases;
$options = Database::getConnection()
->getConnectionOptions();
$ah_db_name = $options['database'] ?? '';
$ah_db_role = $this
->getDatabaseRole($databases, $ah_db_name);
$sites_folder_name = substr(conf_path(), strrpos(conf_path(), '/') + 1);
$available_indexes = $this
->getIndexes();
$subscription = $this
->getSubscription();
return new SearchApiAcquiaPreferredCore($subscription, $ah_env, $sites_folder_name, $ah_db_role, $available_indexes);
}