protected function Drupal_Apache_Solr_Service::_sendRawPost in Apache Solr Search 5.2
Same name and namespace in other branches
- 6 Drupal_Apache_Solr_Service.php \Drupal_Apache_Solr_Service::_sendRawPost()
- 6.2 Drupal_Apache_Solr_Service.php \Drupal_Apache_Solr_Service::_sendRawPost()
Central method for making a post operation against this Solr Server
Overrides Apache_Solr_Service::_sendRawPost
See also
Apache_Solr_Service::_sendRawGet()
File
- ./
Drupal_Apache_Solr_Service.php, line 284
Class
Code
protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8') {
$request_headers = array(
'Content-Type' => $contentType,
);
list($data, $headers) = $this
->_makeHttpRequest($url, 'POST', $request_headers, $rawPost, $timeout);
$response = new Apache_Solr_Response($data, $headers, $this->_createDocuments, $this->_collapseSingleValueArrays);
$code = (int) $response
->getHttpStatus();
if ($code != 200) {
$message = $response
->getHttpStatusMessage();
if ($code >= 400 && $code != 403 && $code != 404) {
// Add details, like Solr's exception message.
$message .= $response
->getRawResponse();
}
throw new Exception('"' . $code . '" Status: ' . $message);
}
return $response;
}