Author: Aurelien FOUCRET (aurelien.foucret@smile.fr)
Example #1
0
 /**
  * Build document list from the engine raw search response.
  *
  * @param array           $searchResponse  Engine raw search response.
  * @param DocumentFactory $documentFactory Document factory
  *
  * @return void
  */
 private function prepareDocuments(array $searchResponse, DocumentFactory $documentFactory)
 {
     $this->documents = [];
     if (isset($searchResponse['hits'])) {
         $hits = $searchResponse['hits']['hits'];
         foreach ($hits as $hit) {
             $this->documents[] = $documentFactory->create($hit);
         }
         $this->count = $searchResponse['hits']['total'];
     }
 }