diff --git a/src/Engines/TypesenseEngine.php b/src/Engines/TypesenseEngine.php index 5df7c3b..9188e62 100644 --- a/src/Engines/TypesenseEngine.php +++ b/src/Engines/TypesenseEngine.php @@ -124,6 +124,8 @@ public function get(): SearchResults } } + $newPaginator = clone $paginator; + $data = [ 'query' => $this->query, 'total_pages' => $paginator->lastPage(), @@ -132,7 +134,7 @@ public function get(): SearchResults 'per_page' => $paginator->perPage(), 'hits' => $documents, 'facets' => $facets, - 'links' => $paginator->setCollection( + 'links' => $newPaginator->setCollection( collect($results['hits']) )->appends([ 'facets' => http_build_query($this->facets),