setHits() public method

Set the hits value.
public setHits ( $values )
$values
Example #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);
 }
Example #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);
 }