Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Allow to specify types to search on Paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Aug 2, 2017
1 parent 9725eae commit 9209edd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Paginator/ElasticaPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class ElasticaPaginator extends AbstractPaginator
*/
private $index;

/**
* @var array
*/
private $types;

/**
* @param Query $query
* @param $index
Expand Down Expand Up @@ -86,6 +91,17 @@ public function setLimitPerPage($limitPerPage)
return $this;
}

/**
* @param array $types
* @return $this
*/
public function setTypes(array $types)
{
$this->types = $types;

return $this;
}

/**
* @return int
*/
Expand Down Expand Up @@ -130,6 +146,6 @@ private function search()
{
$this->elasticaQuery->setSize($this->limitPerPage);
$this->elasticaQuery->setFrom($this->getOffset());
$this->resultSet = $this->elastica->search($this->elasticaQuery, $this->index);
$this->resultSet = $this->elastica->search($this->elasticaQuery, $this->index, $this->types);
}
}

0 comments on commit 9209edd

Please sign in to comment.