You are here

public function DrupalApacheSolrService::update in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::update()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::update()

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.

Parameters

string $rawPost:

float $timeout Maximum expected duration (in seconds):

Return value

response object

Throws

Exception If an error occurs during the service call

Overrides DrupalApacheSolrServiceInterface::update

5 calls to DrupalApacheSolrService::update()
DrupalApacheSolrService::addDocuments in ./Drupal_Apache_Solr_Service.php
Add an array of Solr Documents to the index all at once
DrupalApacheSolrService::commit in ./Drupal_Apache_Solr_Service.php
Send a commit command. Will be synchronous unless both wait parameters are set to false.
DrupalApacheSolrService::deleteByMultipleIds in ./Drupal_Apache_Solr_Service.php
Create and post a delete document based on multiple document IDs.
DrupalApacheSolrService::deleteByQuery in ./Drupal_Apache_Solr_Service.php
Create a delete document based on a query and submit it
DrupalApacheSolrService::optimize in ./Drupal_Apache_Solr_Service.php
Send an optimize command. Will be synchronous unless both wait parameters are set to false.

File

./Drupal_Apache_Solr_Service.php, line 665

Class

DrupalApacheSolrService
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

public function update($rawPost, $timeout = FALSE) {

  // @todo: throw exception if updates are disabled.
  if (empty($this->update_url)) {

    // Store the URL in an instance variable since many updates may be sent
    // via a single instance of this class.
    $this->update_url = $this
      ->_constructUrl(self::UPDATE_SERVLET, array(
      'wt' => 'json',
    ));
  }
  $options['data'] = $rawPost;
  if ($timeout) {
    $options['timeout'] = $timeout;
  }
  return $this
    ->_sendRawPost($this->update_url, $options);
}