From 66902bab2d3979b3dd325f41f3201bf22cf2acea Mon Sep 17 00:00:00 2001 From: Malte Riechmann Date: Fri, 23 Feb 2024 17:18:45 +0100 Subject: [PATCH] fix: define primary key when adding documents If we do not define the primary key when adding documents, MeiliSearch does not know which should be the primary key Find more information here: https://www.meilisearch.com/docs/learn/core_concepts/primary_key#meilisearch-guesses-your-primary-key --- Classes/Service/IndexService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Service/IndexService.php b/Classes/Service/IndexService.php index 8e5ab50..2337b5b 100644 --- a/Classes/Service/IndexService.php +++ b/Classes/Service/IndexService.php @@ -46,7 +46,7 @@ public function add(Document $document) try { if ($this->client->isHealthy()) { $index = $this->client->index($this->index); - $index->addDocuments($document->toArray()); + $index->addDocuments($document->toArray(), 'id'); } else { $this->logger->warning('MeiliSearch is not healthy.'); }