/** * Create Query Response instance * * @param mixed $rawResponse * @return QueryResponse */ public function create($rawResponse) { $documents = array(); foreach ($rawResponse['documents'] as $rawDocument) { /** @var \Magento\Framework\Search\Document[] $documents */ $documents[] = $this->documentFactory->create($rawDocument); } /** @var \Magento\Framework\Search\Aggregation $aggregations */ $aggregations = $this->documentFactory->create($rawResponse['aggregation']); return $this->objectManager->create('\\Magento\\Framework\\Search\\QueryResponse', ['documents' => $documents, 'aggregations' => $aggregations]); }