? Zend ? servlet-request-612024-7-6x-2x.patch Index: CHANGELOG.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/CHANGELOG.txt,v retrieving revision 1.1.2.99.2.43 diff -u -p -r1.1.2.99.2.43 CHANGELOG.txt --- CHANGELOG.txt 19 Oct 2009 14:46:52 -0000 1.1.2.99.2.43 +++ CHANGELOG.txt 26 Oct 2009 02:11:03 -0000 @@ -5,6 +5,8 @@ Apache Solr integration x.x-x.x, xxxx-xx Apache Solr integration 6.x-2.x, xxxx-xx-xx ------------------------------ +#612024 by pwolanin, Add method to allow requests to additional Solr servelets. + #561082 by pwolanin, consolidate Solr delete queries on cron. #580404 by pwolanin per content type comment exclusion. #597174 by Frando, add hook_apachesolr_prepare_query() to enable custom sorts. Index: Drupal_Apache_Solr_Service.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Drupal_Apache_Solr_Service.php,v retrieving revision 1.1.2.20.2.2 diff -u -p -r1.1.2.20.2.2 Drupal_Apache_Solr_Service.php --- Drupal_Apache_Solr_Service.php 19 Oct 2009 14:46:52 -0000 1.1.2.20.2.2 +++ Drupal_Apache_Solr_Service.php 26 Oct 2009 02:11:03 -0000 @@ -185,6 +185,56 @@ class Drupal_Apache_Solr_Service extends } /** + * Make a request to a servlet (a path) that's not a standard path. + * + * @param string $servlet + * A path to be added to the base Solr path. e.g. 'extract/tika' + * + * @param array $params + * Any request parameters when constructing the URL. + * + * @param string $method + * 'GET', 'POST', 'PUT', or 'HEAD'. + * + * @param array $request_headers + * Keyed array of header names and values. Should include 'Content-Type' + * for POST or PUT. + * + * @param string $rawPost + * Must be an empty string unless method is POST or PUT. + * + * @param float $timeout + * Read timeout in seconds or FALSE. + * + * @return + * Apache_Solr_Response object + */ + public function makeServletRequest($servlet, $params = array(), $method = 'GET', $request_headers = array(), $rawPost = '', $timeout = FALSE) { + if ($method == 'GET' || $method == 'HEAD') { + // Make sure we are not sending a request body. + $rawPost = ''; + } + // Add default params. + $params += array( + 'wt' => self::SOLR_WRITER, + ); + + $url = $this->_constructUrl($servlet, $params); + list ($data, $headers) = $this->_makeHttpRequest($url, $method, $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; + } + + /** * Put Luke meta-data from the cache into $this->luke when we instantiate. * * @see Apache_Solr_Service::__construct() Index: apachesolr.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v retrieving revision 1.1.2.12.2.155.2.31 diff -u -p -r1.1.2.12.2.155.2.31 apachesolr.module --- apachesolr.module 19 Oct 2009 14:46:52 -0000 1.1.2.12.2.155.2.31 +++ apachesolr.module 26 Oct 2009 02:11:03 -0000 @@ -1184,6 +1184,11 @@ function apachesolr_facetcount_save($edi * } */ function apachesolr_modify_query(&$query, &$params, $caller) { + if (empty($query)) { + // This should only happen if Solr is not set up - avoids fatal errors. + return; + } + // Call the hooks first because otherwise any modifications to the // $query object don't end up in the $params. foreach (module_implements('apachesolr_modify_query') as $module) {