From c0af49f336ea32e3aaa531c364cf2aab7809f1c6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 9 Sep 2020 06:10:00 +0200 Subject: [PATCH] Fix missing search node type. --- app/Support/Search/OperatorQuerySearch.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 9c120b7dd0..017d4c914a 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -39,6 +39,7 @@ use FireflyIII\Support\ParseDateString; use FireflyIII\User; use Gdbots\QueryParser\Node\Field; use Gdbots\QueryParser\Node\Node; +use Gdbots\QueryParser\Node\Numbr; use Gdbots\QueryParser\Node\Phrase; use Gdbots\QueryParser\Node\Word; use Gdbots\QueryParser\ParsedQuery; @@ -220,8 +221,9 @@ class OperatorQuerySearch implements SearchInterface throw new FireflyException(sprintf('Firefly III search cant handle "%s"-nodes', $class)); case Word::class: case Phrase::class: + case Numbr::class: Log::debug(sprintf('Now handle %s', $class)); - $this->words[] = $searchNode->getValue(); + $this->words[] = (string) $searchNode->getValue(); break; case Field::class: Log::debug(sprintf('Now handle %s', $class)); @@ -259,7 +261,7 @@ class OperatorQuerySearch implements SearchInterface $operator = self::getRootOperator($operator); app('telemetry')->feature('search.operators.uses_operator', $operator); - + switch ($operator) { default: Log::error(sprintf('No such operator: %s', $operator)); @@ -679,10 +681,10 @@ class OperatorQuerySearch implements SearchInterface */ private function findCurrency(string $value): ?TransactionCurrency { - if(str_contains($value,'(') && str_contains($value,')')) { + if (str_contains($value, '(') && str_contains($value, ')')) { // bad method to split and get the currency code: $parts = explode(' ', $value); - $value = trim($parts[count($parts) -1], "() \t\n\r\0\x0B"); + $value = trim($parts[count($parts) - 1], "() \t\n\r\0\x0B"); }