James Cole 2024-02-03 13:09:44 +01:00
parent a932965908
commit 3543548ba0
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 10 additions and 1 deletions

View File

@ -136,9 +136,13 @@ class SelectController extends Controller
}
foreach ($textTriggers as $textTrigger) {
$needsContext = config(sprintf('search.operators.%s.needs_context', $textTrigger['type'])) ?? true;
$trigger = new RuleTrigger();
$trigger->trigger_type = $textTrigger['type'];
$trigger->trigger_value = $textTrigger['value'];
if(false === $needsContext) {
$trigger->trigger_value = 'true';
}
$trigger->stop_processing = $textTrigger['stop_processing'];
if ($textTrigger['prohibited']) {
$trigger->trigger_type = sprintf('-%s', $textTrigger['type']);

View File

@ -141,11 +141,16 @@ class RuleRepository implements RuleRepositoryInterface
if ('user_action' === $trigger->trigger_type) {
continue;
}
$needsContext = config(sprintf('search.operators.%s.needs_context', $trigger->trigger_type)) ?? true;
$triggerType = $trigger->trigger_type;
if(str_starts_with($trigger->trigger_type, '-')) {
$triggerType = substr($trigger->trigger_type, 1);
}
$needsContext = config(sprintf('search.operators.%s.needs_context', $triggerType)) ?? true;
if (false === $needsContext) {
$params[] = sprintf('%s:true', OperatorQuerySearch::getRootOperator($trigger->trigger_type));
}
if (true === $needsContext) {
var_dump('x');
$params[] = sprintf('%s:"%s"', OperatorQuerySearch::getRootOperator($trigger->trigger_type), $trigger->trigger_value);
}
}