当前位置: 首页>>代码示例>>PHP>>正文


PHP Apache_Solr_Response::getRawResponse方法代码示例

本文整理汇总了PHP中Apache_Solr_Response::getRawResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Apache_Solr_Response::getRawResponse方法的具体用法?PHP Apache_Solr_Response::getRawResponse怎么用?PHP Apache_Solr_Response::getRawResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Apache_Solr_Response的用法示例。


在下文中一共展示了Apache_Solr_Response::getRawResponse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _sendRawPost

 /**
  * Central method for making a post operation against this Solr Server
  *
  * @see Drupal_Apache_Solr_Service::_sendRawGet()
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     $id = $this->add_request_id($url);
     list($cookie, $nonce) = acquia_search_auth_cookie($url, $rawPost);
     $request_headers = array('Content-Type' => $contentType, 'Cookie' => $cookie, 'User-Agent' => 'acquia_search/' . ACQUIA_SEARCH_VERSION);
     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() . "\n request ID: {$id} \n";
         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;
 }
开发者ID:rtanglao,项目名称:ad6-svn,代码行数:23,代码来源:Acquia_Search_Service.php

示例2: _sendRawPost

 /**
  * Central method for making a post operation against this Solr Server
  *
  * @see Drupal_Apache_Solr_Service::_sendRawGet()
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     if (variable_get('apachesolr_read_only', 0)) {
         throw new Exception('Operating in read-only mode; updates are disabled.');
     }
     $id = $this->add_request_id($url);
     list($cookie, $nonce) = acquia_search_auth_cookie($url, $rawPost);
     if (empty($cookie)) {
         throw new Exception('Invalid authentication string - subscription keys expired or missing.');
     }
     $request_headers = array('Content-Type' => $contentType, 'Cookie' => $cookie, 'User-Agent' => 'acquia_search/' . ACQUIA_SEARCH_VERSION);
     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() . "\n request ID: {$id} \n";
         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;
 }
开发者ID:kdb,项目名称:kbhlydavis,代码行数:29,代码来源:Acquia_Search_Service.php

示例3: _sendRawPost

 /**
  * Central method for making a post operation against this Solr Server
  *
  * @see Apache_Solr_Service::_sendRawGet()
  */
 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;
 }
开发者ID:rtanglao,项目名称:ad6-svn,代码行数:21,代码来源:Drupal_Apache_Solr_Service.php

示例4: getRawResponse

 public function getRawResponse()
 {
     return $this->response->getRawResponse();
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:4,代码来源:Search.php

示例5: makeServletRequest

 /**
  * 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);
     $id = $this->add_request_id($url);
     // We assume we only authenticate the URL for other servlets.
     list($cookie, $nonce) = acquia_search_auth_cookie($url);
     if (empty($cookie)) {
         throw new Exception('Invalid authentication string - subscription keys expired or missing.');
     }
     $request_headers += array('Cookie' => $cookie, 'User-Agent' => 'acquia_search/' . ACQUIA_SEARCH_VERSION);
     list($data, $headers) = $this->_makeHttpRequest($url, $method, $request_headers, $rawPost, $timeout);
     $response = new Apache_Solr_Response($data, $headers, $this->_createDocuments, $this->_collapseSingleValueArrays);
     $hmac = acquia_search_extract_hmac($headers);
     $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);
     } elseif (!acquia_search_valid_response($hmac, $nonce, $data)) {
         throw new Exception('Authentication of search content failed url: ' . $url);
     }
     return $response;
 }
开发者ID:nickflyer,项目名称:OU,代码行数:57,代码来源:Acquia_Search_Service.php

示例6: sendSolrXmlToServer

 /**
  * Posts the given xml document to the Solr server without using the solr php client library.
  *
  * @param DOMDocument $solrXml
  * @return void
  */
 private function sendSolrXmlToServer($solrXml)
 {
     $stream = stream_context_create();
     stream_context_set_option($stream, array('http' => array('method' => 'POST', 'header' => 'Content-Type: text/xml; charset=UTF-8', 'content' => $solrXml->saveXML(), 'timeout' => '3600')));
     $response = new Apache_Solr_Response(@file_get_contents($this->index_server_url . '/update', false, $stream));
     $this->log->debug('Solr Response Status: ' . $response->getHttpStatus());
     if (!$response->getRawResponse()) {
         throw new Opus_SolrSearch_Index_Exception("Solr Server {$this->index_server_url} not responding.");
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:16,代码来源:Indexer.php

示例7: setJsonResponseAsArray

 /**
  *
  * @param Apache_Solr_Response $solrResponse
  */
 private function setJsonResponseAsArray($solrResponse)
 {
     try {
         $this->jsonResponse = Zend_Json::decode($solrResponse->getRawResponse());
         if (is_null($this->jsonResponse)) {
             $this->log->warn("result of decoding solr's json string is null");
         }
     } catch (Exception $e) {
         $this->log->warn("error while decoding solr's json response");
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:15,代码来源:ResponseRenderer.php


注:本文中的Apache_Solr_Response::getRawResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。