From 9729434926d175b0bf7e291b85c1baef1fcd8c88 Mon Sep 17 00:00:00 2001 From: Sobuno Date: Wed, 1 Jan 2025 05:36:22 +0100 Subject: [PATCH] Allow choosing QueryParser implementation --- app/Providers/SearchServiceProvider.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index 627d9f0820..dccd90ddec 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Providers; +use FireflyIII\Support\Search\GdbotsQueryParser; use FireflyIII\Support\Search\OperatorQuerySearch; use FireflyIII\Support\Search\QueryParser; use FireflyIII\Support\Search\QueryParserInterface; @@ -47,10 +48,13 @@ class SearchServiceProvider extends ServiceProvider { $this->app->bind( QueryParserInterface::class, - static function (Application $app) { - /** @var QueryParser $queryParser */ - $queryParser = app(QueryParser::class); - return $queryParser; + static function () { + $implementation = env('QUERY_PARSER_IMPLEMENTATION', 'default'); + + return match($implementation) { + 'new' => app(QueryParser::class), + default => app(GdbotsQueryParser::class), + }; } );