Skip to content

Commit

Permalink
feat: Use str_replace for replacement
Browse files Browse the repository at this point in the history
Use str_replace for the replacement.
Allows to use additional static terms in a query term
  • Loading branch information
erkenes committed Sep 12, 2022
1 parent 364cff5 commit eac73e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Classes/NodeSearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ public function findByProperties($term, array $searchNodeTypes, Context $context
array_walk_recursive(
$request,
static function (&$value) use ($replacements) {
$value = $replacements[$value] ?? $value;
foreach ($replacements as $replacementKey => $replacement) {
if (strpos($value, $replacementKey)) {
$value = str_replace($replacementKey, $replacement, $value);
}
}
}
);

Expand Down

0 comments on commit eac73e3

Please sign in to comment.