You are here

function search_api_acquia_add_solr_overrides in Acquia Search for Search API 7.2

Overrides search_api_solr configs to talk to the proper Acquia search core.

It determines proper (preferred) Acquia search core to which the site should be connected and overrides the Search API config accordingly. If a proper search core is not found, it enables the read-only mode so that the site does not unintentionally connect to the wrong core and corrupts its index.

Parameters

array $servers: The Search API Solr servers.

Return value

bool True if preferred core has been found in the list of available cores and it was used to override the search settings.

1 call to search_api_acquia_add_solr_overrides()
search_api_acquia_init in ./search_api_acquia.module
Implements hook_init().

File

./search_api_acquia.module, line 93
Provides integration between your Drupal site and Acquia's hosted search service via the Search API Solr module.

Code

function search_api_acquia_add_solr_overrides($servers) {
  $override = FALSE;

  /**
   * @var string $acquia_server_id
   * @var SearchApiServer $server
   */
  foreach ($servers as $acquia_server_id => $server) {
    $core_service = search_api_acquia_get_core_service($server
      ->getAcquiaSearchApiVersion());
    $override |= search_api_acquia_override_server($core_service, $acquia_server_id);
  }
  return $override;
}