hits() public method

Get the raw hits array from Elasticsearch results.
public hits ( ) : array
return array
示例#1
0
 /**
  * PlasticPaginator constructor.
  *
  * @param PlasticResult $result
  * @param int           $limit
  * @param int           $page
  */
 public function __construct(PlasticResult $result, $limit, $page)
 {
     $this->result = $result;
     parent::__construct($result->hits(), $result->totalHits(), $limit, $page, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
     $hitsReference =& $this->items;
     $result->setHits($hitsReference);
 }
示例#2
0
 /**
  * Fill the results hists into Model.
  *
  * @param Model  $model
  * @param Result $result
  *
  * @return mixed|void
  */
 public function fill(Model $model, Result $result)
 {
     $hits = $result->hits()->map(function ($hit) use($model) {
         return $this->fillModel($model, $hit);
     });
     $result->setHits($hits);
 }