public function Apache_Solr_Service::deleteByQuery in Apache Solr Search 5
Create a delete document based on a query and submit it
Parameters
string $rawQuery Expected to be utf-8 encoded:
boolean $fromPending:
boolean $fromCommitted:
Return value
Throws
Exception If an error occurs during the service call
File
- SolrPhpClient/
Apache/ Solr/ Service.php, line 809
Class
- Apache_Solr_Service
- 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, $fromPending = true, $fromCommitted = true) {
$pendingValue = $fromPending ? 'true' : 'false';
$committedValue = $fromCommitted ? 'true' : 'false';
// escape special xml characters
$rawQuery = htmlspecialchars($rawQuery, ENT_NOQUOTES, 'UTF-8');
$rawPost = '<delete fromPending="' . $pendingValue . '" fromCommitted="' . $committedValue . '"><query>' . $rawQuery . '</query></delete>';
return $this
->delete($rawPost);
}