matchish / laravel-scout-elasticsearch

Search among multiple models with ElasticSearch and Laravel Scout
MIT License
699 stars 113 forks source link

[Feature] Use SearchableScope instead PageScope #264

Open olennikoff opened 9 months ago

olennikoff commented 9 months ago

Offset search is very slow in the import, need use chunkById More info for comparsion https://www.laravel-enlightn.com/blog/laravel-offset-vs-cursor-pagination/

matchish commented 9 months ago

Good idea. How would SearchableScope looks like?

olennikoff commented 9 months ago

It integrated into Scout /vendor/laravel/scout/src/SearchableScope.php

matchish commented 9 months ago

Could you share the solution?

yocmen commented 6 months ago

@matchish @olennikoff on my fork https://github.com/yocmen/laravel-scout-elasticsearch/tree/add-pagination-mode i have something for this, it improves a lot the way to import

https://github.com/yocmen/laravel-scout-elasticsearch/commit/51b9edc926115512a6f7baaacc53cc7dba362d2e

It uses the Cache Facade.

Note: I'm still looking for ways to improve it in large tables (3M+) + relationships eager loaded, any idea is welcomed and I can add a PR for this if needed.