/** * Performs an update query, returns the raw response. * * Unlike update(), does not force wt=json. * * @param Update $update * * @return Response */ public function updateRaw(Update $update) { $path = $this->updatePath($update); $body = $update->getBody(); $contentType = $update->getContentType(); $headers = []; if (isset($contentType)) { $headers['Content-Type'] = $contentType; } return $this->client->post($path, $body, $headers); }
private function importFile(Client $client, $core, SplFileInfo $source, $output) { $output->writeln("Importing data from: <info>{$source}</info>"); $fp = fopen($source, 'r'); $path = "{$core}/update?" . http_build_query(['commit' => 'true', 'wt' => 'json']); $headers = ['Content-Type' => 'application/json']; $response = $client->post($path, $fp, $headers); $contents = $response->getBody()->getContents(); $reply = Json::decode($contents); if ($reply->responseHeader->status != 0) { throw new \Exception("Solr returned an error."); } $time = $reply->responseHeader->QTime; $output->writeln("Time taken: <comment>{$time} ms</comment>\n"); }