Skip to content

Commit 2a5845e

Browse files
committed
Fix implementation
1 parent 4a91d8e commit 2a5845e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Engine.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ public function cursorPaginate(Builder $builder, $perPage = null, $cursorName =
124124
throw new InvalidArgumentException('OpenSearch cursor pagination requires at least one explicit sort.');
125125
}
126126

127-
$response = $this->documentManager->search($searchRequest->indexName(), $searchRequest->request());
127+
$response = $builder->applyAfterRawSearchCallback(
128+
$this->documentManager->search($searchRequest->indexName(), $searchRequest->request())
129+
);
128130

129131
return new CursorPaginator(
130132
$this->map($builder, $response, $builder->model),

src/OpenSearchScoutServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function registerBuilderMacros(): void
9191
throw new BadMethodCallException('Scout cursor pagination is only available for the OpenSearch engine.');
9292
}
9393

94-
return $engine->cursorPaginate($this, $perPage, $cursorName, $cursor);
94+
return $engine->cursorPaginate($this, $perPage, $cursorName, $cursor)->appends('query', $this->query);
9595
});
9696
}
9797
}

0 commit comments

Comments
 (0)