public function Apache_Solr_Service_Balancer::addDocuments in Apache Solr Search 5
Add an array of Solr Documents to the index all at once
Parameters
array $documents Should be an array of Apache_Solr_Document instances:
boolean $allowDups:
boolean $overwritePending:
boolean $overwriteCommitted:
Return value
Throws
Exception If an error occurs during the service call
File
- SolrPhpClient/
Apache/ Solr/ Service/ Balancer.php, line 519
Class
- Apache_Solr_Service_Balancer
- Reference Implementation for using multiple Solr services in a distribution. Functionality includes: routing of read / write operations failover (on selection) for multiple read servers
Code
public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true) {
$service = $this
->_selectWriteService();
do {
try {
return $service
->addDocuments($documents, $allowDups, $overwritePending, $overwriteCommitted);
} catch (Exception $e) {
if ($e
->getCode() != 0) {
//IF NOT COMMUNICATION ERROR
throw $e;
}
}
$service = $this
->_selectWriteService(true);
} while ($service);
return false;
}