You are here

public function SearchApiSolrConnection::deleteByQuery in Search API Solr 7

Sends a delete request for all documents that match the given Solr query.

Parameters

string $rawQuery: The query whose results should be deleted. Expected to be UTF-8 encoded.

int|false $timeout: Seconds to wait until timing out with an exception. Defaults to an hour.

Return value

object A response object.

Throws

SearchApiException If an error occurs during the service call.

Overrides SearchApiSolrConnectionInterface::deleteByQuery

File

includes/solr_connection.inc, line 831

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

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