Reputation: 119
It seems that I did all the instructions from Laravel documentation to use Scout with 'database' engine.
Environment settings:
SCOUT_DRIVER=database
Migration:
public function up(): void
{
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->index();
$table->unsignedBigInteger('parent_id')->index()->nullable();
$table->string('status')->default(StatusEnum::TODO);
$table->string('priority')->default(\App\Enums\PriorityEnum::MID)->index();
$table->string('title')->fullText();
$table->text('description')->fullText();
$table->timestamps();
$table->timestamp('completed_at')->nullable();
});
}
with the fullText indexes.
Have done sail artisan scout:import "App\Models\Task"
command.
Code for retrieving
Task::search($value)->get();
where $value is coming from request.
This query returns all records from the 'tasks' table, which I don't need of course.
What didn't I do?
HELP me Please
Upvotes: 2
Views: 61