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

[Feature] Question? MixedSearch - How to eager load realtionships and use pagination() at same time? #227

Open
PitchRE opened this issue Dec 19, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@PitchRE
Copy link

PitchRE commented Dec 19, 2022

      $data =   MixedSearch::search($request->q ?? '')->within(implode(',', $searchTypes))->query(function ($query) {
            $query->with('media');
        })->get();

I would like to eager load some relationship and use pagination. If I use paginate() with query(), it throws SQLSTATE[42000]: Syntax error or access violation.

SELECT count(*) AS aggregate FROM `mixed_search`.`php:20$20cs` WHERE `mixed_search`.`php:20$20cs`.`id` IN (7, 9, 4, 5)
@PitchRE PitchRE added the enhancement New feature or request label Dec 19, 2022
matchish added a commit that referenced this issue Dec 20, 2022
@matchish
Copy link
Owner

matchish commented Feb 1, 2023

@PitchRE Did you try this approach to load relations?
https://github.com/matchish/laravel-scout-elasticsearch#eager-load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants