Skip to content

Commit

Permalink
Merge pull request #36 from bakaphp/feature-custom-limit-and-sort
Browse files Browse the repository at this point in the history
 fix trait properties
  • Loading branch information
kaioken authored Feb 11, 2020
2 parents f4df718 + 20b72d9 commit 0bdb987
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Contracts/Converter/CustomQueriesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ trait CustomQueriesTrait
*
* @var int
*/
protected $limit;
protected $limit = 25;

/**
* Custom Sort.
*
* @var string
*/
protected $sort;
protected $sort = null;

/**
* Set the custom columns provide by the user.
Expand Down
2 changes: 1 addition & 1 deletion src/Converter/RequestUriToElasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function convert(): array
if (!is_null($this->sort)) {
$rawSql['sql'] .= $this->sort;
}

// Calculate the corresponding offset
$this->offset = ($this->page - 1) * $this->limit;
$rawSql['sql'] .= " LIMIT {$this->limit} OFFSET {$this->offset}";
Expand Down

0 comments on commit 0bdb987

Please sign in to comment.