public function PreferredSearchCore::getListOfPossibleCores in Acquia Search 3.x
Returns a list of all possible search core IDs.
The core IDs are generated based on the current site configuration.
Return value
array E.g. [ 'WXYZ-12345.dev.mysitedev_db', 'WXYZ-12345.dev.mysitedev_folder1', ]
1 call to PreferredSearchCore::getListOfPossibleCores()
- PreferredSearchCore::getPreferredCore in src/
PreferredSearchCore.php - Returns the preferred core from the list of available cores.
File
- src/
PreferredSearchCore.php, line 183
Class
- PreferredSearchCore
- Return the Preferred search core for Solr.
Namespace
Drupal\acquia_searchCode
public function getListOfPossibleCores() {
$possible_core_ids = [];
// In index naming, we only accept alphanumeric chars.
$sites_foldername = preg_replace('/[^a-zA-Z0-9]+/', '', $this->sitesFolderName);
$ah_env = preg_replace('/[^a-zA-Z0-9]+/', '', $this->ahEnv);
$context = [
'ah_env' => $ah_env,
'ah_db_role' => $this->ahDbRole,
'identifier' => Storage::getIdentifier(),
'sites_foldername' => $sites_foldername,
];
// The Acquia Search module isn't configured properly.
if (!Storage::getIdentifier()) {
// Let other modules arbitrary alter the list possible cores.
\Drupal::moduleHandler()
->alter('acquia_search_get_list_of_possible_cores', $possible_core_ids, $context);
return $possible_core_ids;
}
// The Acquia Search Solr module tries to use this core before any auto
// detected core in case if it's set in the site configuration.
if ($override_search_core = Storage::getSearchCoreOverride()) {
$possible_core_ids[] = $override_search_core;
}
if ($ah_env) {
// When there is an Acquia DB role defined, priority is to pick
// WXYZ-12345.[env].[db_role], then WXYZ-12345.[env].[site_foldername].
if ($this->ahDbRole) {
$possible_core_ids[] = $this->acquiaIdentifier . '.' . $ah_env . '.' . $this->ahDbRole;
}
$possible_core_ids[] = $this->acquiaIdentifier . '.' . $ah_env . '.' . $sites_foldername;
}
// Let other modules arbitrary alter the list possible cores.
\Drupal::moduleHandler()
->alter('acquia_search_get_list_of_possible_cores', $possible_core_ids, $context);
return $possible_core_ids;
}