Skip to content

Commit

Permalink
[4.x] Remove duplication of code in search:results tag, and treat pag…
Browse files Browse the repository at this point in the history
…ination params as integer types (#8314)

Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
ryanmitchell and jasonvarga committed Jun 29, 2023
1 parent 241253e commit fb9b3c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/Search/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public function results()
$builder = Search::index($this->params->get('index'))
->ensureExists()
->search($query)
->withData($supplementData)
->limit($this->params->get('limit'))
->offset($this->params->get('offset'));
->withData($supplementData);

$this->querySite($builder);
$this->queryStatus($builder);
Expand Down
6 changes: 3 additions & 3 deletions src/Tags/Concerns/GetsQueryResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ protected function results($query)
{
$this->setPaginationParameterPrecedence();

if ($paginate = $this->params->get('paginate')) {
if ($paginate = $this->params->int('paginate')) {
return $this->paginatedResults($query, $paginate);
}

if ($limit = $this->params->get('limit')) {
if ($limit = $this->params->int('limit')) {
$query->limit($limit);
}

if ($offset = $this->params->get('offset')) {
if ($offset = $this->params->int('offset')) {
$query->offset($offset);
}

Expand Down

0 comments on commit fb9b3c0

Please sign in to comment.