Skip to content

Scout Import fails with eager loaded relationships #12

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

Open
nhuebnereagle opened this issue May 25, 2017 · 2 comments
Open

Scout Import fails with eager loaded relationships #12

nhuebnereagle opened this issue May 25, 2017 · 2 comments

Comments

@nhuebnereagle
Copy link

First - Thank you for making a PostgreSql extension for Scout! I was able to resolve the issue, but still reporting it in case it's something in Scout or the driver. If I need to bring this over to Scout, let me know and I can do that.

The following code in my model was causing a PostgreSql error. This code automatically loads my relationships when I pull back a record:

Model Relationships Causing Error

protected $with = [
    'category',
    'attachments',
];

Here's the error I would get when attempting a Scout Import using the Command Line command:

PostgreSql Error

SQLSTATE[HY093]: Invalid parameter number: parameter was not defined (SQL: select to_tsvector(COALESCE(english, get_current_ts_config()), 177) || to_tsvector(COALESCE(english, get_current_ts_config()), 2017-05-25 09:46:03) || to_tsvector(COALESCE(english, get_current_ts_config()), 2017-05-25 09:46:03) || to_tsvector(COALESCE(english, get_current_ts_config()), ) || to_tsvector(COALESCE(english, get_current_ts_config()), ) || to_tsvector(COALESCE(english, get_current_ts_config()), ) || to_tsvector(COALESCE(english, get_current_ts_config()), 1) || to_tsvector(COALESCE(english, get_current_ts_config()), Videos) || to_tsvector(COALESCE(english, get_current_ts_config()), 23) || to_tsvector(COALESCE(english, get_current_ts_config()), <pTest Article Content</p>) || to_tsvector(COALESCE(english, get_current_ts_config()), ) || to_tsvector(COALESCE(english, get_current_ts_config()), 23) || to_tsvector(COALESCE(2017-05-23 16:26:58, get_current_ts_config()), 2017-05-23 16:26:58) || to_tsvector(COALESCE(, get_current_ts_config()), ) AS tsvector limit 1)

After commenting out the above code from my model I was able to import successfully:

Success

#> php artisan scout:import "App\Data\Models\HelpCenter\Article" 

Imported [App\Data\Models\HelpCenter\Article] models up to ID: 235
All [App\Data\Models\HelpCenter\Article] records have been imported.
@countnoobula
Copy link

My understanding of the problem is that the library doesn't supported nested arrays in toSearchableArray returns.

I haven't had capacity to look at resolving this, but have encountered this several times while working with this library.

@alekciy
Copy link

alekciy commented Sep 9, 2020

I have the same problem. @countnoobula right. Nested array (model property is array).

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

No branches or pull requests

3 participants