1
votes

I am trying to add algolia search system into my laravel(5.6) web app. For this,

I followed below instructions

  1. composer require laravel/scout

  2. php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

  3. use Searchable trait into my User model

  4. use Laravel\Scout\Searchable;

  5. composer require algolia/algoliasearch-client-php

  6. php artisan scout:import "App\User"

I also set (ALGOLIA_APP_ID) and (ALGOLIA_SECRET) both of my .env and scout.php file

I also added some dummy data to my users table and when I try to import those data to my algolia site by using (php artisan scout:import "App\User") this command I am getting this error (Class 'AlgoliaSearch\Version' not found)

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

1
Based on algolia.com/doc/framework-integration/laravel/install it looks like they use the version ^1.27 meanwhile you're using the version ^2.0 Could be the version ^2.0 not compatible with scout.Clément Baconnier
Please add code as text, not images. Have you tried running composer dumpautoload?aynber
I run composer dumpautoload but the same problem againMehedi Hasan Methun
finally after changing the version it worked...Thanks cbaconnierMehedi Hasan Methun

1 Answers

3
votes

I had the almost same problem

When I was doing the batch import using the command php artisan scout:import got this Error: In EngineManager.php line 31: Class 'AlgoliaSearch\Version' not found

Downgrading the version fixed it

composer require algolia/algoliasearch-client-php:^1.27