Ejemplo n.º 1
0
 /**
  * @return Collection
  */
 public function getResult()
 {
     $ids = [];
     foreach ($this->result['hits'] as $hit) {
         $ids[array_get($hit, 'objectID')] = $hit;
     }
     return $this->engine->getConfigurator()->getQueryForFoundDocuments($ids)->get();
 }
 /**
  * @return Collection
  */
 public function getResult()
 {
     $ids = [];
     $items = array_get($this->result, 'hits.hits', []);
     foreach ($items as $hit) {
         $ids[array_get($hit, '_id')] = $hit;
     }
     $items = $this->engine->getConfigurator()->getQueryForFoundDocuments($ids)->get();
     //$items->each(function(Model $item) use($items) {
     //    // In addition to setting the attributes
     //    // from the index, we will set the score as well.
     //    $item->setDocumentScore(array_get($items, $item->getKey() . '._score'));
     //
     //    // Set our document version
     //    $item->documentVersion = array_get($items, $item->getKey() . '._version');
     //});
     return $items;
 }