From a48dc2e0c108108e0cce9347b8e75f975b316b73 Mon Sep 17 00:00:00 2001 From: Oleh Isaiev Date: Wed, 13 Nov 2024 12:32:55 +0200 Subject: [PATCH] Add changelog and update documentation --- CHANGELOG.md | 9 +++++++-- README.md | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09b16f2..8b72353 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/) ## [Unreleased] +### Fixed +- [Using pagination with custom query in Scout Builder](https://github.com/matchish/laravel-scout-elasticsearch/pull/290). +### Added +- [Using `options()` of a builder](https://github.com/matchish/laravel-scout-elasticsearch/issues/252) for set `from` parameter. +- Supporting `take()` method of builder for setting response `size`. ## [7.8.0] - 2024-06-24 ### Added -- [Added supports of whereNotIn condition]([https://github.com/matchish/laravel-scout-elasticsearch/pull/282](https://github.com/matchish/laravel-scout-elasticsearch/pull/286). -- +- [Added supports of whereNotIn condition](https://github.com/matchish/laravel-scout-elasticsearch/pull/282). + ## [7.6.2] - 2024-06-24 ### Fixed - [Change if conditions order in soft deletes check for compatibility](https://github.com/matchish/laravel-scout-elasticsearch/pull/282). diff --git a/README.md b/README.md index 66d0895..f5b0bfd 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,25 @@ Product::search() Full list of ElasticSearch terms is in `vendor/handcraftedinthealps/elasticsearch-dsl/src/Query/TermLevel`. +### Pagination +The engine supports [Elasticsearch pagination](https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html) +with [Scout Builder pagination](https://laravel.com/docs/11.x/scout#pagination) or by setting page sizes +and offsets using the `->take($size)` method and `->options(['from' => $from])`. + +> Caution : Builder pagination takes precedence over the `take()` and `options()` setting. + +For example: + +```php +Product::search() + ->take(20) + ->options([ + 'from' => 20, + ]) + ->paginate(50); +``` +This will return the first 50 results, ignoring the specified offset. + ### Search amongst multiple models You can do it with `MixedSearch` class, just pass indices names separated by commas to the `within` method. ```php