pdphilip / laravel-elasticsearch

Laravel Elasticsearch: An Elasticsearch implementation of Laravel's Eloquent ORM
https://elasticsearch.pdphilip.com/
MIT License
95 stars 17 forks source link

Help term()->search() with paginate #50

Closed SergejGuruliov closed 1 month ago

SergejGuruliov commented 1 month ago

How to paginate term search $result = Story::term($terms)->search(); $records = $result->paginate(10); [Method Illuminate\Database\Eloquent\Collection::paginate does not exist.]

pdphilip commented 1 month ago

Hey @SergejGuruliov , documentation is in the process of being redone but you can do full text search now with normal get() type queries since v4.2.0

You can do:

$result = Story::searchTerm($term)->paginate(10);
//Or
$result = Story::searchTerm($term)->searchTerm($term)->paginate(10);
$result = Story::searchTerm($term)->orSearchTerm($term)->paginate(10);

See v4.2.0

Cheers