I am using laravel scout with meilisearch driver.
The problem is:
When I run the command php artisan scout:import "App\Models\Article"
the below error is shown:
I am using laravel 8.
MeiliSearch\Exceptions\ApiException
Internal error: panic
at vendor/meilisearch/meilisearch-php/src/Http/Client.php:197
193▕ private function parseResponse(ResponseInterface $response)
194▕ {
195▕ if ($response->getStatusCode() >= 300) {
196▕ $body = json_decode($response->getBody()->getContents(), true) ?? $response->getReasonPhrase();
➜ 197▕ throw new ApiException($response, $body);
198▕ }
199▕
200▕ return json_decode($response->getBody()->getContents(), true);
201▕ }
+26 vendor frames
27 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
the content of composer.json is like this:
"require": {
"laravel/scout": "^9.2",
"meilisearch/meilisearch-php": "^0.18.3"
},
Article
model:
class Article extends Model
{
use HasFactory, Searchable;
protected $table = 'article';
public function searchableAs()
{
return 'body';
}
public function toSearchableArray(){
return $this->only(['title' , 'body']);
}
}
Finally, I found the solution.
I must use this command for running meilisearch:
./meilisearch --db-path ./meilifiles --http-addr '127.0.0.1:7700' --master-key="hS3w2KEJCsLdpdaSZIZg"
Instead of this command:
./meilisearch --master-key="hS3w2KEJCsLdpdaSZIZg"