/**
  * Commits the data to the Solr index, making it available for search.
  *
  * This will perform Solr 'soft commit', which means there is no guarantee that data
  * is actually written to the stable storage, it is only made available for search.
  * Passing true will also write the data to the safe storage, ensuring durability.
  *
  * @param bool $flush
  */
 public function commit($flush = false)
 {
     $payload = $flush ? '<commit/>' : '<commit softCommit="true"/>';
     foreach ($this->endpointResolver->getEndpoints() as $endpointName) {
         $result = $this->client->request('POST', $this->endpointRegistry->getEndpoint($endpointName), '/update', new Message(array('Content-Type' => 'text/xml'), $payload));
         if ($result->headers['status'] !== 200) {
             throw new RuntimeException('Wrong HTTP status received from Solr: ' . $result->headers['status'] . var_export($result, true));
         }
     }
 }
 /**
  * Perform request to client to search for records with query string.
  *
  * @param array $parameters
  *
  * @return mixed
  */
 protected function search(array $parameters)
 {
     $queryString = $this->generateQueryString($parameters);
     $response = $this->client->request('GET', $this->endpointRegistry->getEndpoint($this->endpointResolver->getEntryEndpoint()), "/select?{$queryString}");
     // @todo: Error handling?
     $result = json_decode($response->body);
     if (!isset($result->response)) {
         throw new RuntimeException('->response not set: ' . var_export(array($result, $parameters), true));
     }
     return $result;
 }