Skip to content

Firefly III: a personal finances manager

Allow choosing QueryParser implementation

Sobuno9729434926d1
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),
+ };
}
);