Bug 9282: (follow-up) remove log noise caused by authorities/ysearch.pl
authorGalen Charlton <gmc@esilibrary.com>
Thu, 10 Oct 2013 22:46:18 +0000 (22:46 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 10 Oct 2013 22:46:18 +0000 (22:46 +0000)
This patch (which is incidental to the main patches for bug 9282),
improves the AJAX authority search code by fixing incorrect contruction
of the parameters to SearchAuthorities() that led to errors like this
in the Apache log when doing auto-completion searches on "main entry"
and "anywhere" in the authority finder:

   ysearch.pl: Use of uninitialized value $i in string eq ...

In the process, this patch also removes a use of the now-deprecated
Perl smartmatch operator.

To test:

[1] Verify that the main test plan for bug 9282 still works.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
authorities/ysearch.pl

index 7996c6d..b669c08 100755 (executable)
@@ -48,14 +48,8 @@ if ( $auth_status ne "ok" ) {
     exit 0;
 }
 
-    my $searchstr = $query->param('term');
+    my @value      = $query->param('term');
     my $searchtype = $query->param('querytype');
-    my @value;
-    given ($searchtype) {
-        when (/^marclist$/)      { @value = (undef, undef, $searchstr); }
-        when (/^mainentry$/)     { @value = (undef, $searchstr, undef); }
-        when (/^mainmainentry$/) { @value = ($searchstr, undef, undef); }
-    }
     my @marclist  = ($searchtype);
     my $authtypecode = $query->param('authtypecode');
     my @and_or    = $query->param('and_or');