Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Explicitly use map() or lazyMap(). #470

Merged
merged 3 commits into from
Apr 26, 2021

Conversation

crynobone
Copy link
Member

When I first created PR #439 it was under the impression we can use QueryBuilder::cursor() and everything works the same. However new feedback from @JosephSilber there are some limitations to doing this, including eager loading.

image

Changes

  • Engine::map() will use Searchable::getScoutModelsByIds() which will return eloquent collection.
  • Engine::lazyMap() will use Searchable::queryScoutModelsByIds() which will return eloquent builder (where we can use cursor()).

Limitation

I not sure if we are able to use lazy() or lazyById() as far as I know since chunking the result as we need to sort by relevant search results.

Signed-off-by: Mior Muhammad Zaki crynobone@gmail.com

@taylorotwell taylorotwell merged commit d95efe1 into laravel:master Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants