James Cole 2021-10-30 21:32:02 +02:00
parent 8561f3e177
commit 90d4545a1f
No known key found for this signature in database
GPG Key ID: BDE6667570EADBD5

View File

@ -156,7 +156,7 @@ class OperatorQuerySearch implements SearchInterface
$parser = new QueryParser(); $parser = new QueryParser();
try { try {
$query1 = $parser->parse($query); $query1 = $parser->parse($query);
} catch (TypeError|LogicException $e) { } catch (TypeError | LogicException $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
Log::error(sprintf('Could not parse search: "%s".', $query)); Log::error(sprintf('Could not parse search: "%s".', $query));
throw new FireflyException('Invalid search value. See the logs.', 0, $e); throw new FireflyException('Invalid search value. See the logs.', 0, $e);
@ -245,6 +245,7 @@ class OperatorQuerySearch implements SearchInterface
private function handleSearchNode(Node $searchNode): void private function handleSearchNode(Node $searchNode): void
{ {
$class = get_class($searchNode); $class = get_class($searchNode);
Log::debug(sprintf('Now in handleSearchNode(%s)', $class));
switch ($class) { switch ($class) {
default: default:
Log::error(sprintf('Cannot handle node %s', $class)); Log::error(sprintf('Cannot handle node %s', $class));
@ -252,7 +253,7 @@ class OperatorQuerySearch implements SearchInterface
case Subquery::class: case Subquery::class:
// loop all notes in subquery: // loop all notes in subquery:
foreach ($searchNode->getNodes() as $subNode) { // @phpstan-ignore-line foreach ($searchNode->getNodes() as $subNode) { // @phpstan-ignore-line
$this->handleSearchNode($subNode); // lets hope its not too recursive! $this->handleSearchNode($subNode); // let's hope it's not too recursive!
} }
break; break;
case Word::class: case Word::class:
@ -282,13 +283,15 @@ class OperatorQuerySearch implements SearchInterface
'value' => (string)$value, 'value' => (string)$value,
] ]
); );
} else { Log::debug(sprintf('Added operator type "%s"', $operator));
}
if (!in_array($operator, $this->validOperators, true)) {
Log::debug(sprintf('Added INVALID operator type "%s"', $operator));
$this->invalidOperators[] = [ $this->invalidOperators[] = [
'type' => $operator, 'type' => $operator,
'value' => (string)$value, 'value' => (string)$value,
]; ];
} }
break;
} }
} }
@ -302,7 +305,7 @@ class OperatorQuerySearch implements SearchInterface
*/ */
private function updateCollector(string $operator, string $value): bool private function updateCollector(string $operator, string $value): bool
{ {
Log::debug(sprintf('updateCollector("%s", "%s")', $operator, $value)); Log::debug(sprintf('Now in updateCollector("%s", "%s")', $operator, $value));
// check if alias, replace if necessary: // check if alias, replace if necessary:
$operator = self::getRootOperator($operator); $operator = self::getRootOperator($operator);