algolia / scout-extended

Scout Extended: The Full Power of Algolia in Laravel
https://www.algolia.com/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended/
MIT License
393 stars 85 forks source link

scout:reimport not creating all indexes #318

Open tao opened 1 year ago

tao commented 1 year ago

Description

This bug* causes an issue on Laravel Nova, as using scout:reimport does not create all the indexes, which means the global search on Nova stops working. When you use scout:import is works correctly.

Steps To Reproduce

If I run an import it produces this in the terminal:

$ php artisan scout:import  

 [OK] All [App\Search\Combined] records have been flushed.                                            
Imported [App\Search\Combined] models up to ID: App\Models\Ingredient::1
 [OK] All [App\Search\Combined] records have been imported.                                           
 [OK] All [App\Models\Ingredient] records have been flushed.                                          
Imported [App\Models\Ingredient] models up to ID: App\Models\Ingredient::1
 [OK] All [App\Models\Ingredient] records have been imported.                                         
 [OK] All [App\Models\Medicine] records have been flushed.                                            
Imported [App\Models\Medicine] models up to ID: App\Models\Medicine::1
 [OK] All [App\Models\Medicine] records have been imported.                                           
 [OK] All [App\Models\Cosmetic] records have been flushed.                                            
Imported [App\Models\Cosmetic] models up to ID: App\Models\Cosmetic::4
 [OK] All [App\Models\Cosmetic] records have been imported.                                           
 [OK] All [App\Models\Organization] records have been flushed.                                        
Imported [App\Models\Organization] models up to ID: App\Models\Organization::1
 [OK] All [App\Models\Organization] records have been imported.                                       

On the Algolia dashboard it shows the indexes exist:

Screenshot 2023-01-11 at 22 55 19

And I can search for them on Nova:

Screenshot 2023-01-11 at 22 55 50

When I run scout:reimport though something else happens...


 🔎 Importing: [App\Search\Combined,App\Models\Ingredient,App\Models\Medicine,App\Models\Cosmetic,App\Models\Organization]

  0/15 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0% Creating temporary index temp_combined
  2/15 [▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░]  13% Importing records to index temp_combined
  3/15 [▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░]  20% Replacing index combined by index temp_combined
 Creating temporary index temp_ingredients
  5/15 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33% Importing records to index temp_ingredients
  6/15 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  40% Replacing index ingredients by index temp_ingredients
 Creating temporary index temp_medicines
  8/15 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░]  53% Importing records to index temp_medicines
 Replacing index medicines by index temp_medicines
 Creating temporary index temp_cosmetics
 11/15 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  73% Importing records to index temp_cosmetics
 Replacing index cosmetics by index temp_cosmetics
 Creating temporary index temp_organizations
 14/15 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░]  93% Importing records to index temp_organizations
 15/15 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% Replacing index organizations by index temp_organizations

 [OK] All                                                                                             
      [App\Search\Combined,App\Models\Ingredient,App\Models\Medicine,App\Models\Cosmetic,App\Models\Or
      ganization] records have been imported                                                          

But when I look at the dashboard not all the indexes exist anymore:

Screenshot 2023-01-11 at 22 57 25

So when I search in Nova again, it finds nothing because it tries to look in the Ingredients index and it's not there:

Screenshot 2023-01-11 at 22 58 07