Skip to content

Commit

Permalink
Merge pull request #255 from algolia/fix/serialize-once
Browse files Browse the repository at this point in the history
Serialize entities only once - fix #253
  • Loading branch information
julienbourdeau authored Sep 4, 2018
2 parents af07217 + d26dca8 commit 8fb2850
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Engine/AlgoliaEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ protected function doUpdate($searchableEntities)

$data = [];
foreach ($searchableEntities as $entity) {
if (empty($entity->getSearchableArray())) {
$searchableArray = $entity->getSearchableArray();
if (empty($searchableArray)) {
continue;
}

Expand All @@ -98,7 +99,7 @@ protected function doUpdate($searchableEntities)
$data[$indexName] = [];
}

$data[$indexName][] = $entity->getSearchableArray() + [
$data[$indexName][] = $searchableArray + [
'objectID' => $entity->getId()
];
}
Expand Down

0 comments on commit 8fb2850

Please sign in to comment.