You are here

public function SearchApiSolrConnection::deleteByMultipleIds in Search API Solr 7

Sends a delete request for several documents, based on the document IDs.

Parameters

array $ids: The IDs of the documents which 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::deleteByMultipleIds

1 call to SearchApiSolrConnection::deleteByMultipleIds()
SearchApiSolrConnection::deleteById in includes/solr_connection.inc
Sends a delete request based on a document ID.

File

includes/solr_connection.inc, line 817

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

public function deleteByMultipleIds(array $ids, $timeout = 3600) {
  $rawPost = '<delete>';
  foreach ($ids as $id) {
    $rawPost .= '<id>' . htmlspecialchars($id, ENT_NOQUOTES, 'UTF-8') . '</id>';
  }
  $rawPost .= '</delete>';
  return $this
    ->update($rawPost, $timeout);
}