r414@llin: dpavlin | 2006-01-08 23:09:49 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 8 Jan 2006 22:09:33 +0000 (22:09 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 8 Jan 2006 22:09:33 +0000 (22:09 +0000)
 and finally fix for all wired cases (I hope) [2.10]

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@373 07558da8-63fa-0310-ba24-9fe276d99e06

TODO
conf/log.conf
lib/WebPAC.pm
lib/WebPAC/Normalize.pm
t/3-normalize-xml.t

diff --git a/TODO b/TODO
index 4b18f0b..b7c1a33 100644 (file)
--- a/TODO
+++ b/TODO
@@ -8,7 +8,7 @@
 + add more input formats (MARC::Fast and others) [2.00_6]
 + update to use Search::Estraier [2.09]
 + fix characters generated in [% search %] (move that to Webpacus?)
-- fix nasty bug with repeatable subfields [2.10]
++ fix nasty bug with repeatable subfields [2.10]
 - remove delimiters characters from index and query entered
 - delete unused files in database directories
 - scoring for various fields in input/*.xml
index f03e0cc..fb4ffa5 100644 (file)
@@ -6,7 +6,7 @@ log4perl.rootLogger=INFO, LOG, SCREEN
 #, SCREEN
 
 # you can specify methods from WebPAC here also!
-log4perl.logger.main=INFO
+#log4perl.logger.main=INFO
 #log4perl.logger.main=DEBUG
 
 #log4perl.logger.WebPAC=DEBUG
@@ -24,12 +24,10 @@ log4perl.logger.main=INFO
 #log4perl.logger.WebPAC.Input.ISIS.fetch=DEBUG
 #log4perl.logger.WebPAC.Input.ISIS.open=DEBUG
 
-#log4perl.logger.WebPAC.Normalize=DEBUG
+#log4perl.logger.WebPAC.Normalize.=DEBUG
 #log4perl.logger.WebPAC.Normalize.new=DEBUG
 #log4perl.logger.WebPAC.Normalize.XML=DEBUG
 #log4perl.logger.WebPAC.Normalize.data_structure=DEBUG
-#log4perl.logger.WebPAC.Normalize.fill_in_to_arr=DEBUG
-#log4perl.logger.WebPAC.Normalize.parse_to_arr=DEBUG
 
 #log4perl.logger.WebPAC.Output.TT=DEBUG
 #log4perl.logger.WebPAC.Output.Estraier=DEBUG
index 52aceae..8c705d7 100644 (file)
@@ -9,11 +9,11 @@ WebPAC - core module
 
 =head1 VERSION
 
-Version 2.09
+Version 2.10
 
 =cut
 
-our $VERSION = '2.09';
+our $VERSION = '2.10';
 
 =head1 SYNOPSIS
 
index 3ab53d2..c210a12 100644 (file)
@@ -204,7 +204,7 @@ sub data_structure {
                        }
                        if (! @v) {
                                $log->debug("$field <",$self->{tag},"> format: $format no values");
-#                              next;
+                               next;
                        } else {
                                $log->debug("$field <",$self->{tag},"> format: $format values: ", join(",", @v));
                        }
@@ -532,21 +532,27 @@ sub _rec_to_arr {
        $log->logconfess("need HASH as first argument!") if ($rec !~ /HASH/o);
        return if (! $format_utf8);
 
+       $log->debug("using $code on $format_utf8");
+
        my $i = 0;
        my $max = 0;
        my @arr;
        my $rec_size = {};
 
        while ($i <= $max) {
-               my $v = $self->$code($rec,$format_utf8,$i++,\$rec_size) || next;
-               push @arr, $v;
+               my @v = $self->$code($rec,$format_utf8,$i++,\$rec_size);
                if ($rec_size) {
                        foreach my $f (keys %{ $rec_size }) {
                                $max = $rec_size->{$f} if ($rec_size->{$f} > $max);
                        }
-                       warn "max set to $max, rec_size = ", Dumper($rec_size);
+                       $log->debug("max set to $max");
                        undef $rec_size;
                }
+               if (@v) {
+                       push @arr, @v;
+               } else {
+                       push @arr, '';
+               }
        }
 
        $log->debug("format '$format_utf8' returned ",--$i," elements: ", sub { join(" | ",@arr) }) if (@arr);
index 606118d..ea357ce 100755 (executable)
@@ -171,7 +171,7 @@ sub parse_test($$$$$) {
        push @{$rec->{'000'}}, 42 unless ($rec->{'000'});
        #diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec);
        ok(my $ds = $n->data_structure( $rec ), "data_structure");
-       diag Dumper($ds) if ($i == 0);
+       #diag Dumper($ds->{$tag}->{display}); # if ($i == 0);
        cmp_ok($ds->{$tag}->{display}->[$i], 'eq', $r, "parse $tag/$i - $r");
 }
 
@@ -246,7 +246,7 @@ $import = {
                { content => 'v900^x' },
        ] },
        'Tag_s1' => { 'isis' => [
-               { content => 's900^b = s900^x' },
+               { content => 'v900^a = v900^c' },
        ] },
        'Tag_s2' => { 'isis' => [
                { content => 's900^a s900^b s900^c s900^x' },
@@ -257,5 +257,5 @@ parse_test_arr($import, 'Tag_a', $rec, [ '','a1','','a2' ] );
 parse_test_arr($import, 'Tag_b', $rec, [ 'b1','b2','b3','b4' ] );
 parse_test_arr($import, 'Tag_c', $rec, [ '','','c1','c2' ] );
 parse_test_arr($import, 'Tag_x', $rec, [ 'b1','a1_b2','b3_c1','a2_b4_c2' ] );
-parse_test_arr($import, 'Tag_s1', $rec, [ 'b1 = b1', 'b1 = b1', 'b1 = b1', 'b1 = b1' ] );
+parse_test_arr($import, 'Tag_s1', $rec, [ '', 'a1', 'c1', 'a2 = c2' ] );