/**
  * 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;
 }
 /**
  * Returns search hits for the given array of Solr query parameters.
  *
  * @param array $parameters
  * @param array $languageSettings - a map of filters for the returned fields.
  *        Currently supported: <code>array("languages" => array(<language1>,..))</code>.
  *
  * @return mixed
  */
 protected function internalFind(array $parameters, array $languageSettings = array())
 {
     $searchTargets = $this->getSearchTargets($languageSettings);
     if (!empty($searchTargets)) {
         $parameters['shards'] = $searchTargets;
     }
     $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;
 }