Skip to content

Firefly III: a personal finances manager

Fix search result page.

James Coleb6960dc29910
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 8b330ce8ca..690d50e65a 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -375,8 +375,10 @@ class GroupCollector implements GroupCollectorInterface
public function excludeSearchWords(array $array): GroupCollectorInterface
{
if (0 === count($array)) {
+ Log::debug('No excluded search words provided, skipping.');
return $this;
}
+ Log::debug(sprintf('%d excluded search words provided.', count($array)));
$this->query->where(
static function (EloquentBuilder $q) use ($array): void {
$q->where(
@@ -949,8 +951,10 @@ class GroupCollector implements GroupCollectorInterface
public function setSearchWords(array $array): GroupCollectorInterface
{
if (0 === count($array)) {
+ Log::debug('No words in array');
return $this;
}
+ Log::debug(sprintf('%d word(s) in array', count($array)));
$this->query->where(
static function (EloquentBuilder $q) use ($array): void {
$q->where(
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 5fd97cde7e..4df7866212 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -146,7 +146,7 @@ class OperatorQuerySearch implements SearchInterface
*/
public function parseQuery(string $query): void
{
- app('log')->debug(sprintf('Now in parseQuery(%s)', $query));
+ app('log')->debug(sprintf('Now in parseQuery("%s")', $query));
/** @var QueryParserInterface $parser */
$parser = app(QueryParserInterface::class);
app('log')->debug(sprintf('Using %s as implementation for QueryParserInterface', get_class($parser)));
diff --git a/phpunit.xml b/phpunit.xml
index 22375c0467..c609c44fa0 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -35,6 +35,7 @@
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_LOG_ENV" value="notice"/>
+ <env name="QUERY_PARSER_IMPLEMENTATION" value="new"/>
<ini name="xdebug.mode" value="coverage"/>
</php>
<testsuites>
diff --git a/resources/views/search/index.twig b/resources/views/search/index.twig
index 07c5b20866..92bb453811 100644
--- a/resources/views/search/index.twig
+++ b/resources/views/search/index.twig
@@ -83,7 +83,7 @@
</div>
</div>
</div>
- {% if query|length > 0 or excludedWords|length > 0 or operators|length > 0 %}
+ {% if query|length > 0 or words|length > 0 or excludedWords|length > 0 or operators|length > 0 %}
<div class="row result_row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box search_box">
@@ -138,7 +138,7 @@
</div>
</div>
{% endif %}
- {% if query|length == 0 and excludedWords|length == 0 and operators|length == 0 %}
+ {% if query|length == 0 and excludedWords|length == 0 and words|length == 0 and operators|length == 0 %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">