public function Apache_Solr_Service::deleteById in Apache Solr Search 5
Create a delete document based on document ID
Parameters
string $id 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 786
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 deleteById($id, $fromPending = true, $fromCommitted = true) {
$pendingValue = $fromPending ? 'true' : 'false';
$committedValue = $fromCommitted ? 'true' : 'false';
//escape special xml characters
$id = htmlspecialchars($id, ENT_NOQUOTES, 'UTF-8');
$rawPost = '<delete fromPending="' . $pendingValue . '" fromCommitted="' . $committedValue . '"><id>' . $id . '</id></delete>';
return $this
->delete($rawPost);
}