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

Reimporting aggregators only #273

Open
mokhosh opened this issue Mar 24, 2021 · 7 comments
Open

Reimporting aggregators only #273

mokhosh opened this issue Mar 24, 2021 · 7 comments

Comments

@mokhosh
Copy link

mokhosh commented Mar 24, 2021

  • Laravel version: latest
  • Algolia Scout Extended version: latest
  • Algolia Client Version: latest

Description

With scout:reimport you can specify which searchable model you want to reimport. But if you have an aggregator called News for example you cannot say scout:reimport News, you get:

Class "News" not found 

Steps To Reproduce

Make an aggregator
Try to reimport aggregator only

@DevinCodes DevinCodes added enhancement New feature or request good first issue Good for newcomers labels Mar 24, 2021
@DevinCodes
Copy link
Contributor

DevinCodes commented Mar 29, 2021

Hi @mokhosh ,

Did you try passing the full classname (including namespace) to the command? For example, if your News aggregator lives in the default App\Search namespace:

php artisan scout:reimport "App\Search\News"

This should find the aggregator and reimport it. Let me know if it works for you 🙂

@DevinCodes DevinCodes removed enhancement New feature or request good first issue Good for newcomers labels Mar 29, 2021
@mokhosh
Copy link
Author

mokhosh commented Mar 29, 2021

Thanks @DevinCodes for the response. It did work. I think it would be nice to have a config for aggregates folder that defaults to "app/Search" and we would look there too in addition to models folder when we're reimporting, so we don't need to explicitly indicate the namespace.

@DevinCodes
Copy link
Contributor

I would love to hear what others think of such an option before we decide to implement it 🙂 Let's discuss!

@srlbarron
Copy link

Hi all,

I'm running the reimport like this php artisan scout:reimport "App\Search\News" however, it only runs for the first class in the $models array.

What am I doing wrong?

@DevinCodes
Copy link
Contributor

Hi @srlbarron ,

Do all classes in your $models array implement the Searchable trait? If so, what happens if you change the order of your classes; does it still only import the first, or does it only import a specific class?

Thank you in advance!

@srlbarron
Copy link

Hi @DevinCodes, I got it solved and I honestly don't know what it was.

Possible causes:

  • I was using a free account to test my stuff and it got quota'ed
  • Running on laravel 6 with newer scout versions
  • Lots of legacy custom code on my end (not my fault thought ;) )

@DevinCodes
Copy link
Contributor

Okay, great to hear it got solved! 😄

Happy coding @srlbarron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants