Skip to content

Commit

Permalink
Manage the indexed_attributes field to ensure being compliant with ne…
Browse files Browse the repository at this point in the history
…xt Elasticsuite release.
  • Loading branch information
romainruaud committed Jan 10, 2018
1 parent 1a3c79c commit f585de7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Model/Product/Indexer/Fulltext/Datasource/RatingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ public function addData($storeId, array $indexData)
foreach ($ratingData as $ratingDataRow) {
$productId = (int) $ratingDataRow['product_id'];
$indexData[$productId]['ratings_summary'] = (float) $ratingDataRow['ratings_summary'];

if (!isset($indexData[$productId]['indexed_attributes'])) {
$indexData[$productId]['indexed_attributes'] = ['ratings_summary'];
} elseif (!in_array('ratings_summary', $indexData[$productId]['indexed_attributes'])) {
// Add ratings_summary only one time.
$indexData[$productId]['indexed_attributes'][] = 'ratings_summary';
}
}

return $indexData;
Expand Down

0 comments on commit f585de7

Please sign in to comment.