Hello everyone.
I want to use Laravel Redisearch driver for Scout in my project. I have Ubuntu 18.04 with Redis server and full-text search extension for it. ( works fine from Redis CLI,
I checked).
Also I installed ethanhann/Laravel-RediSearch package and counfigure scout_driver variable in .env and in config/scout.php. When I want to import my model for indexing using scout:import command, error ocures:
The field is not a property in the index. id
My model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
class Search_test extends Model
{
use Searchable;
protected $primaryKey ='id';
protected $table='Search_test';
protected $connection = 'pgsql';
public function toSearchableArray()
{
$array = [
'id' => $this->id,
'name' => $this->name,
'value' => $this->value
];
//There are only 3 fields :id, name and value
return $array;
}
public function searchableAs()
{
return 'search_test_index';
}
}
I think that you don't need this is in your Model.
'id' => $this->id,
public function toSearchableArray($id)
{
$array = [
'name' => $this->name,
'value' => $this->value
];
//There are only 3 fields :id, name and value
return $array;
}