Bug 35833: Silence few warnings from searching

Resolve:
[2024/01/18 11:31:24] [WARN] Use of uninitialized value $hits in numeric eq (==) at /usr/share/koha/opac/opac-search.pl line 612.
[2024/01/18 11:31:24] [WARN] Use of uninitialized value $times in subtraction (-) at /usr/share/koha/C4/Search.pm line 1715.

Test plan:
Look for a few search expressions without results.
Check log without and with patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cb7921d8d0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2024-01-18 14:46:45 +01:00 committed by Fridolin Somers
parent 5ab93391a3
commit 89db37bd91
2 changed files with 2 additions and 2 deletions

View file

@ -1694,7 +1694,7 @@ sub searchResults {
$times = $offset + $results_per_page;
}
else {
$times = $hits; # If less hits than results_per_page+offset we go to the end
$times = $hits // 0; # If less hits than results_per_page+offset we go to the end
}
my $marcflavour = C4::Context->preference("marcflavour");

View file

@ -608,7 +608,7 @@ for my $plugin_variables ( @plugin_responses ) {
for (my $i=0;$i<@servers;$i++) {
my $server = $servers[$i];
if ($server && $server =~/biblioserver/) { # this is the local bibliographic server
$hits = $results_hashref->{$server}->{"hits"};
$hits = $results_hashref->{$server}->{"hits"} // 0;
if ( $hits == 0 && $basic_search ){
$operands[0] = '"'.$operands[0].'"'; #quote it
## I. BUILD THE QUERY