Skip to content

Commit ede1c19

Browse files
committed
fix: ensure page and per_page options are set in query
1 parent 7cb148a commit ede1c19

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)