This commit is contained in:
team 1
2026-05-10 12:07:27 +02:00
parent 886b6fac84
commit 63210a14de
6 changed files with 143 additions and 14 deletions

View File

@@ -1783,7 +1783,11 @@ final readonly class AgentRunner
)
: $shopSearchQuery;
$template = $this->agentRunnerConfig->getGenericDeviceQueryAnchorTemplate();
$template = trim((string) ($rule['template'] ?? ''));
if ($template === '') {
$template = $this->agentRunnerConfig->getGenericDeviceQueryAnchorTemplate();
}
if ($template === '') {
return $shopSearchQuery;
}

View File

@@ -1428,7 +1428,7 @@ final class AgentRunnerConfig
}
/**
* @return array<int, array{anchor: string, match_terms: string[]}>
* @return array<int, array{anchor: string, match_terms: string[], template?: string}>
*/
public function getGenericDeviceQueryAnchorRules(): array
{
@@ -1470,10 +1470,20 @@ final class AgentRunnerConfig
continue;
}
$rules[] = [
$normalizedRule = [
'anchor' => $anchor,
'match_terms' => $matchTerms,
];
$template = $rule['template'] ?? null;
if (is_scalar($template)) {
$template = trim((string) $template);
if ($template !== '') {
$normalizedRule['template'] = $template;
}
}
$rules[] = $normalizedRule;
}
return $rules;

View File

@@ -1402,6 +1402,10 @@ final readonly class RetriexEffectiveConfigProvider
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s.anchor must be a non-empty string.', (string) $index);
}
if (array_key_exists('template', $rule) && (!is_string($rule['template']) || trim((string) $rule['template']) === '')) {
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s.template must be a non-empty string when configured.', (string) $index);
}
$this->validateStringList(
$this->toList($rule['match_terms'] ?? []),
sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s.match_terms', (string) $index),