Bug 9986: Two fixes for Z3950 search
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 3 Apr 2013 14:36:25 +0000 (16:36 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 15 Apr 2013 12:44:11 +0000 (08:44 -0400)
Searching for stdid: Standard ID, srchany: RAW (any) somehow did not work
anymore.
Probably my fault :) Note that these two fields are in Cataloging Z3950 search
and not in Acquisition.

Fixing encoding problems: When adding -utf flag for CGI in acqui/z3950 and
cataloging/z3950, the decoding statements in C4/Breeding, Z3950Search should be
removed.

Test plan:
Search in Cataloging with:
Standard ID: 9782358670043 on LOC
RAW (any): musee [add an accent aigu on first e]  on LOC  -- Add diacritic!!!

Search in Acquisition
Somewhere, does not matter, but use a diacritic.

A note: My git version still has a hard time with utf8. Need to upgrade to version 1.7.10 to resolve this..

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described. No errors
Without patch z39.50 search for example Std ID OR musee gives no results,
with patch there are.
No problems in acq search.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Good catch, passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
C4/Breeding.pm
acqui/z3950_search.pl
cataloguing/z3950_search.pl

index 4d26be6..01aca21 100644 (file)
@@ -243,6 +243,8 @@ sub Z3950Search {
     my $lccn= $pars->{lccn};
     my $lccall= $pars->{lccall};
     my $controlnumber= $pars->{controlnumber};
+    my $srchany= $pars->{srchany};
+    my $stdid= $pars->{stdid};
 
     my $show_next       = 0;
     my $total_pages     = 0;
@@ -280,12 +282,10 @@ sub Z3950Search {
         $nterms++;
     }
     if ($title) {
-        utf8::decode($title);
         $query .= " \@attr 1=4 \"$title\" ";
         $nterms++;
     }
     if ($author) {
-        utf8::decode($author);
         $query .= " \@attr 1=1003 \"$author\" ";
         $nterms++;
     }
@@ -294,7 +294,6 @@ sub Z3950Search {
         $nterms++;
     }
     if ($subject) {
-        utf8::decode($subject);
         $query .= " \@attr 1=21 \"$subject\" ";
         $nterms++;
     }
@@ -310,6 +309,14 @@ sub Z3950Search {
         $query .= " \@attr 1=12 \"$controlnumber\" ";
         $nterms++;
     }
+    if($srchany) {
+        $query .= " \@attr 1=1016 \"$srchany\" ";
+        $nterms++;
+    }
+    if($stdid) {
+        $query .= " \@attr 1=1007 \"$stdid\" ";
+        $nterms++;
+    }
     for my $i (1..$nterms-1) {
         $query = "\@and " . $query;
     }
index 5247d67..0ae843f 100755 (executable)
@@ -21,7 +21,7 @@
 
 use warnings;
 use strict;
-use CGI;
+use CGI qw/-utf8/;
 
 use C4::Auth;
 use C4::Output;
index 05f5f2b..425a6c1 100755 (executable)
@@ -106,8 +106,8 @@ my $pars= {
         subject => $subject,
         lccall => $lccall,
         controlnumber => $controlnumber,
-        stdid => 0,
-        srchany => 0,
+        stdid => $stdid,
+        srchany => $srchany,
 };
 Z3950Search($pars, $template);
 output_html_with_http_headers $input, $cookie, $template->output;