diff --git a/src/SearchResults.php b/src/SearchResults.php index 7967282..10077d5 100644 --- a/src/SearchResults.php +++ b/src/SearchResults.php @@ -123,6 +123,14 @@ public function add(Result $result): self return $this; } + /** + * @return array + */ + public function getIDs(): array + { + return $this->results?->column('RecordID') ?? []; + } + /** * @var array */ diff --git a/src/SearchResults/Result.php b/src/SearchResults/Result.php index d7a3539..70d4cc3 100644 --- a/src/SearchResults/Result.php +++ b/src/SearchResults/Result.php @@ -9,7 +9,6 @@ * Class Result * @package BimTheBam\Meilisearch\SearchResults * @property DataObject|null $Record - * @property float $Score */ class Result extends ViewableData { @@ -24,13 +23,13 @@ class Result extends ViewableData protected ?DataObject $record = null; /** - * @param string $recordClassName - * @param int $recordID + * @param string $RecordClassName + * @param int $RecordID */ public function __construct( - protected readonly string $recordClassName, - protected readonly int $recordID, - protected readonly float $score + public readonly string $RecordClassName, + public readonly int $RecordID, + public readonly float $Score ) { parent::__construct(); } @@ -46,14 +45,6 @@ public function getRecord(): ?DataObject $this->recordFetched = true; - return $this->record = DataObject::get_by_id($this->recordClassName, $this->recordID); - } - - /** - * @return float - */ - public function getScore(): float - { - return $this->score; + return $this->record = DataObject::get_by_id($this->RecordClassName, $this->RecordID); } }