search index

This commit is contained in:
2023-10-22 16:09:36 +03:00
parent 1a6de5c1bb
commit e2e3842cd0
7 changed files with 42 additions and 11 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ namespace Lucent\Record;
use JsonSerializable;
use stdClass;
use Illuminate\Support\Str;
class Record implements JsonSerializable
{
@@ -23,6 +24,7 @@ class Record implements JsonSerializable
public function toDB(): array
{
$searchIndex = trim(Str::lower(collect($this->data)->values()->join(" ")." ". $this->_file?->originalName ?? ""));
return [
"id" => $this->id,
"status" => $this->status->value,
@@ -30,6 +32,7 @@ class Record implements JsonSerializable
"_sys" => json_encode($this->_sys),
"_file" => json_encode($this->_file),
"data" => json_encode($this->data),
"search" => $searchIndex,
];
}
@@ -61,5 +64,4 @@ class Record implements JsonSerializable
}
}