class AcquiaSearchService in Acquia Search 6.3
Hierarchy
- class \DrupalApacheSolrService implements DrupalApacheSolrServiceInterface
- class \AcquiaSearchService
Expanded class hierarchy of AcquiaSearchService
3 string references to 'AcquiaSearchService'
- AcquiaSearchWebTestCase::testEnvironment in tests/
acquia_search.test - Tests Acquia Search environment creation.
- acquia_search_environment_connected in ./
acquia_search.module - Tests whether the environment is connected to Acquia Search.
- acquia_search_get_environment in ./
acquia_search.module - Predefined Acquia Search network environment
File
- ./
Acquia_Search_Service.php, line 9
View source
class AcquiaSearchService extends DrupalApacheSolrService {
/**
* Send an optimize command.
*
* We want to control the schedule of optimize commands ourselves,
* so do a method override to make ->optimize() a no-op.
*
* @see Drupal_Apache_Solr_Service::optimize()
*/
public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600) {
return TRUE;
}
/**
* Modify the url and add headers appropriate to authenticate to Acquia Search.
*
* @return
* The nonce used in the request.
*/
protected function prepareRequest(&$url, &$options, $use_data = TRUE) {
module_load_include('inc', 'acquia_agent', 'acquia_agent_streams');
$id = uniqid();
if (!stristr($url, '?')) {
$url .= "?";
}
else {
$url .= "&";
}
$url .= 'request_id=' . $id;
if ($use_data && isset($options['data'])) {
list($cookie, $nonce) = acquia_search_auth_cookie($url, $options['data'], NULL, $this->env_id);
}
else {
list($cookie, $nonce) = acquia_search_auth_cookie($url, NULL, NULL, $this->env_id);
}
if (empty($cookie)) {
throw new Exception('Invalid authentication string - subscription keys expired or missing.');
}
$options['headers']['Cookie'] = $cookie;
$options['headers'] += array(
'User-Agent' => 'acquia_search/' . variable_get('acquia_search_version', '6.x-3.x'),
);
$options['context'] = acquia_agent_stream_context_create($url, 'acquia_search');
if (!$options['context']) {
throw new Exception(t("Could not create stream context"));
}
return $nonce;
}
/**
* Validate the hmac for the response body.
*
* @return
* The response object.
*/
protected function authenticateResponse($response, $nonce, $url) {
$hmac = acquia_search_extract_hmac($response->headers);
if (!acquia_search_valid_response($hmac, $nonce, $response->data, NULL, $this->env_id)) {
throw new Exception('Authentication of search content failed url: ' . $url);
}
return $response;
}
/**
* Make a request to a servlet (a path) that's not a standard path.
*
* @override
*/
public function makeServletRequest($servlet, $params = array(), $options = array()) {
// Add default params.
$params += array(
'wt' => 'json',
);
$url = $this
->_constructUrl($servlet, $params);
// We assume we only authenticate the URL for other servlets.
$nonce = $this
->prepareRequest($url, $options, FALSE);
$response = $this
->_makeHttpRequest($url, $options);
$response = $this
->checkResponse($response);
return $this
->authenticateResponse($response, $nonce, $url);
}
/**
* Central method for making a GET operation against this Solr Server
*
* @override
*/
protected function _sendRawGet($url, $options = array()) {
$nonce = $this
->prepareRequest($url, $options);
$response = $this
->_makeHttpRequest($url, $options);
$response = $this
->checkResponse($response);
return $this
->authenticateResponse($response, $nonce, $url);
}
/**
* Central method for making a POST operation against this Solr Server
*
* @override
*/
protected function _sendRawPost($url, $options = array()) {
$options['method'] = 'POST';
// Normally we use POST to send XML documents.
if (!isset($options['headers']['Content-Type'])) {
$options['headers']['Content-Type'] = 'text/xml; charset=UTF-8';
}
$nonce = $this
->prepareRequest($url, $options);
$response = $this
->_makeHttpRequest($url, $options);
$response = $this
->checkResponse($response);
return $this
->authenticateResponse($response, $nonce, $url);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaSearchService:: |
protected | function | Validate the hmac for the response body. | |
AcquiaSearchService:: |
public | function |
Make a request to a servlet (a path) that's not a standard path. Overrides DrupalApacheSolrService:: |
|
AcquiaSearchService:: |
public | function |
Send an optimize command. Overrides DrupalApacheSolrService:: |
|
AcquiaSearchService:: |
protected | function | Modify the url and add headers appropriate to authenticate to Acquia Search. | |
AcquiaSearchService:: |
protected | function |
Central method for making a GET operation against this Solr Server Overrides DrupalApacheSolrService:: |
|
AcquiaSearchService:: |
protected | function |
Central method for making a POST operation against this Solr Server Overrides DrupalApacheSolrService:: |
|
DrupalApacheSolrService:: |
protected | property | ||
DrupalApacheSolrService:: |
protected | property | ||
DrupalApacheSolrService:: |
protected | property | Server url | |
DrupalApacheSolrService:: |
protected | property | Flag that denotes whether to use soft commits for Solr 4.x, defaults to FALSE. | |
DrupalApacheSolrService:: |
protected | property | ||
DrupalApacheSolrService:: |
protected | property | ||
DrupalApacheSolrService:: |
protected | property | Constructed servlet full path URLs | |
DrupalApacheSolrService:: |
protected | property | Default HTTP timeout when one is not specified (initialized to default_socket_timeout ini setting) | |
DrupalApacheSolrService:: |
public | function |
Add an array of Solr Documents to the index all at once Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
protected | function | Check the reponse code and thow an exception if it's not 200. | |
DrupalApacheSolrService:: |
public | function |
Clear cached Solr data. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Send a commit command. Will be synchronous unless both wait parameters are set to false. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Create a delete document based on document ID Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Create and post a delete document based on multiple document IDs. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Create a delete document based on a query and submit it Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
private | function | ||
DrupalApacheSolrService:: |
public static | function | Escape a value for special query characters such as ':', '(', ')', '*', '?', etc. | |
DrupalApacheSolrService:: |
public static | function | Escape a value meant to be contained in a phrase for special query characters | |
DrupalApacheSolrService:: |
public | function |
Get just the field meta-data about the index. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
function |
Overrides DrupalApacheSolrServiceInterface:: |
||
DrupalApacheSolrService:: |
public | function |
Get meta-data about the index. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function | Returns the flag that denotes whether to use soft commits for Solr 4.x. | |
DrupalApacheSolrService:: |
public | function | ||
DrupalApacheSolrService:: |
public | function |
Get information about the Solr Core. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Get summary information about the Solr Core. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Get information about the Solr Core. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
public | function |
Get the Solr url Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
protected | function | Like PHP's built in http_build_query(), but uses rawurlencode() and no [] for repeated params. | |
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
constant | How NamedLists should be formatted in the output. This specifically effects facet counts. Valid values are 'map' (default) or 'flat'. | ||
DrupalApacheSolrService:: |
public static | function | Convenience function for creating phrase syntax from a value | |
DrupalApacheSolrService:: |
public | function |
Call the /admin/ping servlet, to test the connection to the server. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
constant | Servlet mappings | ||
DrupalApacheSolrService:: |
public | function |
Simple Search interface Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
protected | function | Sets $this->luke with the meta-data about the index from admin/luke. | |
DrupalApacheSolrService:: |
public | function | Flags whether to use soft commits for Solr 4.x. | |
DrupalApacheSolrService:: |
protected | function | Sets $this->stats with the information about the Solr Core form | |
DrupalApacheSolrService:: |
protected | function | Call the /admin/system servlet | |
DrupalApacheSolrService:: |
public | function |
Set the Solr url. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
public | function |
Raw update Method. Takes a raw post body and sends it to the update service. Post body
should be a complete and well formed xml document. Overrides DrupalApacheSolrServiceInterface:: |
|
DrupalApacheSolrService:: |
constant | |||
DrupalApacheSolrService:: |
protected | function | ||
DrupalApacheSolrService:: |
protected | function | Return a valid http URL given this server's host, port and path and a provided servlet name | |
DrupalApacheSolrService:: |
protected | function | Central method for making the actual http request to the Solr Server | |
DrupalApacheSolrService:: |
public | function |
Constructor Overrides DrupalApacheSolrServiceInterface:: |