Skip to content

Commit

Permalink
Merge pull request #1176 from romainruaud/fix_empty-synonym-tokens
Browse files Browse the repository at this point in the history
Fix the case when analysis tokens are missing.
  • Loading branch information
romainruaud authored Nov 9, 2018
2 parents 35ed43b + 5191fcc commit da37194
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 da37194

Please sign in to comment.