You are here

public function SearchApiSolrConnection::update in Search API Solr 7

Sends a raw update request to the Solr server.

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: The XML document to send to the Solr server's update service.

int|false $timeout: (optional) Maximum expected duration (in seconds).

Return value

object A response object.

Throws

SearchApiException If an error occurs during the service call

Overrides SearchApiSolrConnectionInterface::update

4 calls to SearchApiSolrConnection::update()
SearchApiSolrConnection::addDocuments in includes/solr_connection.inc
Adds an array of Solr Documents to the index all at once
SearchApiSolrConnection::deleteByMultipleIds in includes/solr_connection.inc
Sends a delete request for several documents, based on the document IDs.
SearchApiSolrConnection::deleteByQuery in includes/solr_connection.inc
Sends a delete request for all documents that match the given Solr query.
SearchApiSolrConnection::optimizeOrCommit in includes/solr_connection.inc
Sends a commit or optimize command to the Solr server.

File

includes/solr_connection.inc, line 763

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

public function update($rawPost, $timeout = 3600) {
  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);
}