You are here

function acquia_search_get_environment in Acquia Search 6.3

Predefined Acquia Search network environment

3 calls to acquia_search_get_environment()
AcquiaSearchWebTestCase::setUp in tests/acquia_search.test
Overrides DrupalTestCase::setUp().
acquia_search_enable_acquia_solr_environment in ./acquia_search.module
Create a new record pointing to the Acquia apachesolr search server and set it as the default
acquia_search_environment_edit_form_validate in ./acquia_search.module

File

./acquia_search.module, line 16
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_get_environment($conf = array()) {
  if (!empty($conf['acquia_subscription_id']) && !empty($conf['acquia_subscription_key'])) {
    $identifier = $conf['acquia_subscription_id'];
    $key = $conf['acquia_subscription_key'];
    $subscription = acquia_agent_get_subscription($params = array(), $identifier, $key);
  }
  else {
    $identifier = acquia_agent_settings('acquia_identifier');
    $subscription = acquia_agent_settings('acquia_subscription_data');
  }

  // Adding the subscription specific colony to the heartbeat data
  if (!empty($subscription['heartbeat_data']['search_service_colony'])) {
    $search_base_url = 'http://' . $subscription['heartbeat_data']['search_service_colony'];
  }
  else {
    $search_base_url = variable_get('acquia_search_base_url', 'http://search.acquia.com');
  }
  $environment = array(
    // @todo - server URL may depend on region info.
    'url' => $search_base_url . variable_get('acquia_search_path', '/solr/' . $identifier),
    'service_class' => 'AcquiaSearchService',
    'conf' => array(
      'service_class_info' => array(
        'file' => 'Acquia_Search_Service',
        'module' => 'acquia_search',
        'class' => 'AcquiaSearchService',
      ),
    ),
  );
  return $environment;
}