mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
Fix #4340
This commit is contained in:
parent
84ad8529df
commit
2ad7336605
@ -311,6 +311,7 @@ class SearchRuleEngine implements RuleEngineInterface
|
||||
*/
|
||||
private function findStrictRule(Rule $rule): Collection
|
||||
{
|
||||
Log::debug(sprintf('Now in findStrictRule(#%d)', $rule->id ?? 0));
|
||||
$searchArray = [];
|
||||
/** @var RuleTrigger $ruleTrigger */
|
||||
foreach ($rule->ruleTriggers as $ruleTrigger) {
|
||||
@ -318,18 +319,18 @@ class SearchRuleEngine implements RuleEngineInterface
|
||||
$needsContext = config(sprintf('firefly.search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true;
|
||||
if (false === $needsContext) {
|
||||
Log::debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:true', $ruleTrigger->trigger_type));
|
||||
$searchArray[$ruleTrigger->trigger_type] = 'true';
|
||||
$searchArray[$ruleTrigger->trigger_type][] = 'true';
|
||||
}
|
||||
if (true === $needsContext) {
|
||||
Log::debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:"%s"', $ruleTrigger->trigger_type, $ruleTrigger->trigger_value));
|
||||
$searchArray[$ruleTrigger->trigger_type] = sprintf('"%s"', $ruleTrigger->trigger_value);
|
||||
$searchArray[$ruleTrigger->trigger_type][] = sprintf('"%s"', $ruleTrigger->trigger_value);
|
||||
}
|
||||
}
|
||||
|
||||
// add local operators:
|
||||
foreach ($this->operators as $operator) {
|
||||
Log::debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
|
||||
$searchArray[$operator['type']] = sprintf('"%s"', $operator['value']);
|
||||
$searchArray[$operator['type']][] = sprintf('"%s"', $operator['value']);
|
||||
}
|
||||
|
||||
// build and run the search engine.
|
||||
@ -338,11 +339,12 @@ class SearchRuleEngine implements RuleEngineInterface
|
||||
$searchEngine->setPage(1);
|
||||
$searchEngine->setLimit(31337);
|
||||
|
||||
foreach ($searchArray as $type => $value) {
|
||||
$searchEngine->parseQuery(sprintf('%s:%s', $type, $value));
|
||||
foreach ($searchArray as $type => $searches) {
|
||||
foreach($searches as $value) {
|
||||
$searchEngine->parseQuery(sprintf('%s:%s', $type, $value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = $searchEngine->searchTransactions();
|
||||
|
||||
return $result->getCollection();
|
||||
|
Loading…
Reference in New Issue
Block a user