p85b
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user