Fix search result page.

This commit is contained in:
James Cole
2025-01-05 08:03:15 +01:00
parent 73104aae1f
commit b6960dc299
4 changed files with 8 additions and 3 deletions

View File

@@ -375,8 +375,10 @@ class GroupCollector implements GroupCollectorInterface
public function excludeSearchWords(array $array): GroupCollectorInterface public function excludeSearchWords(array $array): GroupCollectorInterface
{ {
if (0 === count($array)) { if (0 === count($array)) {
Log::debug('No excluded search words provided, skipping.');
return $this; return $this;
} }
Log::debug(sprintf('%d excluded search words provided.', count($array)));
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array): void { static function (EloquentBuilder $q) use ($array): void {
$q->where( $q->where(
@@ -949,8 +951,10 @@ class GroupCollector implements GroupCollectorInterface
public function setSearchWords(array $array): GroupCollectorInterface public function setSearchWords(array $array): GroupCollectorInterface
{ {
if (0 === count($array)) { if (0 === count($array)) {
Log::debug('No words in array');
return $this; return $this;
} }
Log::debug(sprintf('%d word(s) in array', count($array)));
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array): void { static function (EloquentBuilder $q) use ($array): void {
$q->where( $q->where(

View File

@@ -146,7 +146,7 @@ class OperatorQuerySearch implements SearchInterface
*/ */
public function parseQuery(string $query): void 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 */ /** @var QueryParserInterface $parser */
$parser = app(QueryParserInterface::class); $parser = app(QueryParserInterface::class);
app('log')->debug(sprintf('Using %s as implementation for QueryParserInterface', get_class($parser))); app('log')->debug(sprintf('Using %s as implementation for QueryParserInterface', get_class($parser)));

View File

@@ -35,6 +35,7 @@
<php> <php>
<env name="APP_ENV" value="testing"/> <env name="APP_ENV" value="testing"/>
<env name="APP_LOG_ENV" value="notice"/> <env name="APP_LOG_ENV" value="notice"/>
<env name="QUERY_PARSER_IMPLEMENTATION" value="new"/>
<ini name="xdebug.mode" value="coverage"/> <ini name="xdebug.mode" value="coverage"/>
</php> </php>
<testsuites> <testsuites>

View File

@@ -83,7 +83,7 @@
</div> </div>
</div> </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="row result_row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="box search_box"> <div class="box search_box">
@@ -138,7 +138,7 @@
</div> </div>
</div> </div>
{% endif %} {% 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="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="box"> <div class="box">