You are here

public function SearchApiAcquiaSearchService::setConnectionOptions in Acquia Search for Search API 7

Same name and namespace in other branches
  1. 7.2 includes/SearchApiAcquiaSearchService.php \SearchApiAcquiaSearchService::setConnectionOptions()

Set some special overrides for Acquia Search

4 calls to SearchApiAcquiaSearchService::setConnectionOptions()
SearchApiAcquiaSearchService::configurationForm in includes/SearchApiAcquiaSearchService.php
Overrides SearchApiSolrService::configurationForm().
SearchApiAcquiaSearchService::configurationFormValidate in includes/SearchApiAcquiaSearchService.php
Overrides SearchApiSolrService::configurationFormValidate().
SearchApiAcquiaSearchService::connect in includes/SearchApiAcquiaSearchService.php
Overrides SearchApiSolrService::connect().
SearchApiAcquiaSearchService::viewSettings in includes/SearchApiAcquiaSearchService.php
View this server's settings.

File

includes/SearchApiAcquiaSearchService.php, line 62
Contains SearchApiAcquiaSearchService.

Class

SearchApiAcquiaSearchService
Search API service class for Acquia Search.

Code

public function setConnectionOptions() {

  // Modify connection details live on every connect so we do not need to
  // resave the server details if we make modifications in settings.php.
  $identifier = acquia_agent_settings('acquia_identifier');
  $subscription = acquia_agent_settings('acquia_subscription_data');

  // Get our override if we have one. Otherwise use the default.
  $search_host = variable_get('acquia_search_host', 'search.acquia.com');
  if (!empty($subscription['heartbeat_data']['search_service_colony'])) {
    $search_host = $subscription['heartbeat_data']['search_service_colony'];
  }

  // Get our solr path
  $search_path = variable_get('acquia_search_path', '/solr/' . $identifier);
  $this->options['host'] = $search_host;
  $this->options['path'] = $search_path;

  // We can also have overrides per server setting.
  // Apply the overrides in the "search_api_acquia_overrides" variable.
  $name = $this->server->machine_name;
  $overrides = variable_get('search_api_acquia_overrides', array());
  if (isset($overrides[$name]) && is_array($overrides[$name])) {
    $this->options = array_merge($this->options, $overrides[$name]);
  }
}