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

[8.x] Call values() after shouldBeSearchable() #404

Closed
wants to merge 1 commit into from

Conversation

michalisantoniou6
Copy link

If $models->filter->shouldBeSearchable() returns a collection that does not start on index 0 it causes error below.

image

@driesvints driesvints changed the title Call values() after shouldBeSearchable() [8.x] Call values() after shouldBeSearchable() May 9, 2020
@driesvints
Copy link
Member

Probably needs laravel/framework#32747 as an alternative fix.

@cstriuli
Copy link

cstriuli commented Nov 4, 2020

@driesvints using shouldBeSearchable() with a Pivot Model (Illuminate\Database\Eloquent\Relations\Pivot) get an similar error

You can check the class Illuminate\Database\Eloquent\Relations\ConcernsAsPivot::newQueryForCollectionRestoration that needs an array as argument starting with 0 but using (and filtering) shouldBeSearchable in a Pivot Model fails because gets an array starting with a number greater than 0.
image

  • PHP version: 7.4.11
  • Scout version: ^8.3
  • Laravel version: ^8.3
  • Queue connection: redis
  • Scout driver: algolia

Failed artisan scout:reimport (with shouldBeSearchable):

image

Failed Job:

image

Success artisan scout:reimport (without shouldBeSearchable):

image

English is not my mother tongue; sorry for any mistake on my part

@driesvints
Copy link
Member

@cstriuli can you open up an issue on the laravel/framework repo with the full stacktrace?

@cstriuli
Copy link

Done: laravel/framework#35210

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.

None yet

4 participants