Skip to content

Commit bb29d4b

Browse files
committed
Consolidate metadata into single DTO
1 parent 19d2575 commit bb29d4b

3 files changed

Lines changed: 83 additions & 285 deletions

File tree

src/Data/MetaDTO.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
use Illuminate\Support\Arr;
99
use PDPhilip\Elasticsearch\Traits\Makeable;
1010

11+
/**
12+
* Raw ES response transfer object.
13+
*
14+
* Created by the Processor from ES response arrays. Carries response data
15+
* to QueryMeta (collection-level) and ModelMeta (per-model) via their setters.
16+
*
17+
* The set() method allows the Processor to add computed values (query, dsl, total, after_key)
18+
* after construction.
19+
*/
1120
class MetaDTO implements Arrayable
1221
{
1322
use Makeable;

src/Data/ModelMeta.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55
use Illuminate\Support\Arr;
66

7+
/**
8+
* Per-model metadata.
9+
*
10+
* Manages two concerns:
11+
* - Document metadata from ES responses (score, highlights, sort, cursor, index, docCount, bucket)
12+
* - Table/index identity (table name, prefix, suffix for dynamic indices)
13+
*
14+
* Data flow: ES response → Processor → MetaDTO → ModelMeta (via setMeta)
15+
*/
716
final class ModelMeta
817
{
918
protected string $recordIndex = '';
@@ -26,8 +35,6 @@ final class ModelMeta
2635

2736
protected ?int $docCount = null;
2837

29-
// public array $_query = []; //TBD
30-
3138
public function __construct($table, $tablePrefix)
3239
{
3340
$this->table = $table;
@@ -121,10 +128,6 @@ public function toArray(): array
121128
// ----------------------------------------------------------------------
122129
// Setters
123130
// ----------------------------------------------------------------------
124-
// public function setId($id): void
125-
// {
126-
// $this->_id = $id;
127-
// }
128131

129132
public function setTable($table): void
130133
{

0 commit comments

Comments
 (0)