Skip to content

Commit e4fb435

Browse files
authored
Ensure page and per_page options are set in query (#16)
2 parents 840b104 + ede1c19 commit e4fb435

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Typesense/Query.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ private function ordersToSortBy(array $orders): string
116116

117117
private function getApiResults()
118118
{
119-
$options = ['per_page' => $this->perPage, 'page' => $this->page];
119+
$options = [];
120+
121+
if ($this->page && $this->perPage) {
122+
$options['page'] = $this->page;
123+
$options['per_page'] = $this->perPage;
124+
}
120125

121126
if ($filterBy = $this->wheresToFilter($this->wheres)) {
122127
$options['filter_by'] = $filterBy;

0 commit comments

Comments
 (0)