we need english stemmer because remote database is configured wrong
[Biblio-Z3950.git] / Aleph.pm
index b8c01aa..448beaa 100644 (file)
--- a/Aleph.pm
+++ b/Aleph.pm
@@ -50,15 +50,15 @@ sub diag {
 # WYR - Godina izdavanja
 
 sub usemap {{
-       4               => 'WTI',
-       7               => 'ISBN',
-       8               => 'ISSN',
-       1003            => 'AUT',
-       16              => 'DDC',
-       21              => 'SUB',
-       12              => 'LCN',
+       4               => 'WTI=',
+       7               => 'ISBN=',
+       8               => 'ISSN=',
+       1003    => 'AUT=',
+       16              => 'DDC=',
+       21              => 'SUB=',
+       12              => 'LCN=',
 #      1007    => '',
-       1016    => 'WRD',
+       1016    => 'WRD=',
 }};
 
 our $session_id;
@@ -103,10 +103,10 @@ diag "submit search [$query] on ", $self->{database};
        );
 
        my $hits = 0;
-       if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)}s ) { # FIXME Many results in Crotian
+       if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)} ) { # FIXME Many results in Crotian
                $hits = $1;
                $hits = $2 if $2 && $2 < $1; # correct for max. results
-       } elsif ( $mech->content =~ m{(\d+)\s+od\s+(\d+)}s ) { # FIXME single result in Croatian
+       } elsif ( $mech->content =~ m{(\d+)\s+od\s+(\d+)} ) { # FIXME single result in Croatian
                $hits = $2;
        } else {
                diag "get't find results in ", $mech->content;
@@ -143,6 +143,7 @@ sub next_marc {
 warn "parse $nr";
 
                $marc = MARC::Record->new;
+               $marc->encoding('utf-8');
                $hash = {};
 
                my $html = $mech->content;
@@ -172,6 +173,8 @@ warn "## ++ ", dump( $f, $v );
 
                        my ($i1,$i2) = (' ',' ');
                        ($i1,$i2) = ($2,$3) if $f =~ s/^(...)(.)?(.)?/$1/;
+                       $i1 ||= ' ';
+                       $i2 ||= ' ';
                        my @sf = split(/\|/, $v);
                        @sf = map { s/^(\w)\s+//; { $1 => $_ } } @sf;
 #warn "## sf = ", dump(@sf);