You are here

public function SearchApiAcquiaPreferredCore::getPreferredCore in Acquia Search for Search API 7.2

Returns the preferred core from the list of available search cores.

Return value

array|null NULL or [ 'host' => 'useast11-c4.acquia-search.com', 'index_id' => 'WXYZ-12345.dev.mysitedev', ].

4 calls to SearchApiAcquiaPreferredCore::getPreferredCore()
SearchApiAcquiaPreferredCore::getPreferredCoreHostname in includes/v3/SearchApiAcquiaPreferredCore.php
Returns expected core host based on the current site configs.
SearchApiAcquiaPreferredCore::getPreferredCoreId in includes/v3/SearchApiAcquiaPreferredCore.php
Returns expected core ID based on the current site configs.
SearchApiAcquiaPreferredCore::getPreferredCoreUrl in includes/v3/SearchApiAcquiaPreferredCore.php
Returns preferred core url.
SearchApiAcquiaPreferredCore::isPreferredCoreAvailable in includes/v3/SearchApiAcquiaPreferredCore.php
Determines whether the expected core ID matches any available cores IDs.

File

includes/v3/SearchApiAcquiaPreferredCore.php, line 124

Class

SearchApiAcquiaPreferredCore
Class SearchApiAcquiaPreferredCore.

Code

public function getPreferredCore() {
  $possibleCores = $this
    ->getListOfPossibleCores();
  foreach ($possibleCores as $possibleCore) {
    foreach ($this->availableCores as $availableCore) {
      if ($possibleCore === $availableCore['index_id']) {
        return $availableCore;
      }
    }
  }
  return NULL;
}