/** * @return array */ public function getContentRaw() { return KoSolr_Utils::convert_array_to_solr_query($this->getDataArray()); }
/** * Execute request * @param KoSolr_Server_Request $request * @param int|bool $timeout * @return KoSolr_Server_Response_IExtend * @throws Exception */ public function execute(KoSolr_Server_Request $request, $timeout = FALSE) { $context = stream_context_create(); $url = $this->getRequestUrl() . $request->getRequestHandler(); $header = array('http' => array('timeout' => $timeout ? $timeout : $request->getTimeout())); if ($request->getSendMethod() == KoSolr_Server_Request::SEND_METHOD_POST) { $header['http']['method'] = $request->getSendMethod(); $header['http']['content'] = $request->getContentRaw(); $header['http']['header'] = 'Content-Type: ' . $request->getRequestContentType(); } elseif ($request->getSendMethod() == KoSolr_Server_Request::SEND_METHOD_GET) { $url .= '?' . $request->getContentRaw(); } stream_context_set_option($context, $header); $raw_response = @file_get_contents($url, false, $context); $raw_headerResponse = KoSolr_Utils::http_content_response($http_response_header); if ($raw_headerResponse['httpStatus'] != 200) { throw new KoSolr_Exception("Request url : {$url} Request " . print_r($header, true) . ' Solr Service : ' . $raw_headerResponse['httpStatusMessage']); } return KoSolr_Server_Response::factory($request, $context, $raw_response); }
/** * Set the query string * @param type $QueryString * @return \KoSolr_Server_Request_Search */ public function query($QueryString) { $this->q = KoSolr_Utils::escapePhrase($QueryString); return $this; }