Skip to content

Commit

Permalink
Fix the case when analysis tokens are missing.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Nov 9, 2018
1 parent 35ed43b commit 5191fcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/module-elasticsuite-thesaurus/Model/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private function getSynonymRewrites($storeId, $queryText, $type, $maxRewrites)

$synonymByPositions = [];

foreach ($analysis['tokens'] as $token) {
foreach ($analysis['tokens'] ?? [] as $token) {
if ($token['type'] == 'SYNONYM') {
$positionKey = sprintf('%s_%s', $token['start_offset'], $token['end_offset']);
$token['token'] = str_replace('_', ' ', $token['token']);
Expand Down

0 comments on commit 5191fcc

Please sign in to comment.