You are here

SearchApiAcquiaSearchConnection.php in Acquia Search for Search API 7

Contains SearchApiAcquiaSearchConnection.

File

includes/SearchApiAcquiaSearchConnection.php
View source
<?php

/**
 * @file
 * Contains SearchApiAcquiaSearchConnection.
 */

/**
 * Establishes a connection to the Acquia Search service.
 */
class SearchApiAcquiaSearchConnection extends SearchApiSolrConnection {

  /**
   * Overrides SearchApiSolrConnection::__construct().
   *
   * Uses the Acquia Search HTTP transport instead of the transport provided by
   * the Search API Solr module. This allows us to add the tokens and variables
   * required to authenticate against Acquia's HMAC authentication scheme.
   *
   * @see SearchApiAcquiaSearchHttpTransport
   */
  public function __construct(array $options) {
    parent::__construct($options);
    $this->newClient = trim(parent::SVN_REVISION, '$ :A..Za..z') > 40;
    if ($this->newClient) {
      $this->_httpTransport = new SearchApiAcquiaSearchHttpTransport($this->http_auth);
      if (isset($options['derived_key'])) {
        $this->_httpTransport
          ->setDerivedKey($options['derived_key']);
      }
    }
    else {
      throw new Exception(t('This module only works with the latest version of SolrPhpClient'));
    }
  }

}

Classes

Namesort descending Description
SearchApiAcquiaSearchConnection Establishes a connection to the Acquia Search service.