You are here

public function DrupalApacheSolrService::deleteByQuery in Apache Solr Search 6.3

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

Create a delete document based on a query and submit it

Parameters

string $rawQuery Expected to be utf-8 encoded:

float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception):

Return value

stdClass response object

Throws

Exception If an error occurs during the service call

Overrides DrupalApacheSolrServiceInterface::deleteByQuery

File

./Drupal_Apache_Solr_Service.php, line 791

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 deleteByQuery($rawQuery, $timeout = 3600) {
  $rawPost = '<delete><query>' . htmlspecialchars($rawQuery, ENT_NOQUOTES, 'UTF-8') . '</query></delete>';
  return $this
    ->update($rawPost, $timeout);
}