Bug 28483: Remove warnings from Search.t
There are too many warnings about uninitialized variables in Search.pm. This patch deals with that, the same way it is dealt accross the file: by setting an empty string when things are not defined. To test: 1. Run: $ kshell k$ prove t/db_dependent/Search.t => FAIL: Wow, too many warnings. Some related to this bug, some not. 2. Apply this patch 3. Repeat 1 => SUCCESS: No more warnings! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
0a8f7b3645
commit
b8ab792dc4
20
C4/Search.pm
20
C4/Search.pm
|
|
@ -1197,7 +1197,7 @@ sub buildQuery {
|
|||
my $weight_fields = C4::Context->preference("QueryWeightFields") || 0;
|
||||
my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0;
|
||||
|
||||
my $query = $operands[0];
|
||||
my $query = $operands[0] // "";
|
||||
my $simple_query = $operands[0];
|
||||
|
||||
# initialize the variables we're passing back
|
||||
|
|
@ -1350,7 +1350,7 @@ sub buildQuery {
|
|||
}
|
||||
|
||||
# Detect Truncation
|
||||
my $truncated_operand;
|
||||
my $truncated_operand = q{};
|
||||
my( $nontruncated, $righttruncated, $lefttruncated,
|
||||
$rightlefttruncated, $regexpr
|
||||
) = _detect_truncation( $operand, $index );
|
||||
|
|
@ -1392,14 +1392,14 @@ sub buildQuery {
|
|||
Koha::Logger->get->debug("TRUNCATED OPERAND: >$truncated_operand<");
|
||||
|
||||
# Handle Stemming
|
||||
my $stemmed_operand;
|
||||
my $stemmed_operand = q{};
|
||||
$stemmed_operand = _build_stemmed_operand($operand, $lang)
|
||||
if $stemming;
|
||||
|
||||
Koha::Logger->get->debug("STEMMED OPERAND: >$stemmed_operand<");
|
||||
|
||||
# Handle Field Weighting
|
||||
my $weighted_operand;
|
||||
my $weighted_operand = q{};
|
||||
if ($weight_fields) {
|
||||
$weighted_operand = _build_weighted_query( $operand, $stemmed_operand, $index );
|
||||
$operand = $weighted_operand;
|
||||
|
|
@ -1506,11 +1506,13 @@ sub buildQuery {
|
|||
$query =~ s/(?<=(st-date-normalized)):/=/g;
|
||||
|
||||
# Removing warnings for later substitutions
|
||||
$query //= q{};
|
||||
$query_desc //= q{};
|
||||
$query_cgi //= q{};
|
||||
$limit //= q{};
|
||||
$limit_desc //= q{};
|
||||
$query //= q{};
|
||||
$query_desc //= q{};
|
||||
$query_cgi //= q{};
|
||||
$limit //= q{};
|
||||
$limit_desc //= q{};
|
||||
$limit_cgi //= q{};
|
||||
$simple_query //= q{};
|
||||
$limit =~ s/:/=/g;
|
||||
for ( $query, $query_desc, $limit, $limit_desc ) {
|
||||
s/ +/ /g; # remove extra spaces
|
||||
|
|
|
|||
Loading…
Reference in New Issue