r9064@llin: dpavlin | 2005-11-23 01:15:24 +0100
[webpac2] / run.pl
diff --git a/run.pl b/run.pl
index be7b5f6..ae3f131 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -14,6 +14,8 @@ use WebPAC::Normalize::XML;
 use WebPAC::Output::TT;
 use WebPAC::Output::Estraier;
 
+my $limit = shift @ARGV;
+
 my $abs_path = abs_path($0);
 $abs_path =~ s#/[^/]*$#/#;
 
@@ -25,7 +27,7 @@ my $lookup = new WebPAC::Lookup(
 
 my $isis = new WebPAC::Input::ISIS(
        code_page => 'ISO-8859-2',      # application encoding
-       limit_mfn => 50,
+       limit_mfn => $limit,
 );
 
 my $maxmfn = $isis->open(
@@ -63,7 +65,11 @@ my $est = new WebPAC::Output::Estraier(
        database => 'ps',
 );
 
-while (my $row = $isis->fetch) {
+my $total_rows = 0;
+
+for ( 0 ... $isis->size ) {
+
+       my $row = $isis->fetch || next;
 
        my $mfn = $row->{'000'}->[0] || die "can't find MFN";
 
@@ -71,20 +77,20 @@ while (my $row = $isis->fetch) {
 
 #      print STDERR Dumper($row, $ds);
 
-       my $html = $out->apply(
-               template => 'html_ffzg.tt',
-               data => $ds,
-       );
-
-       # create test output
-
-       my $file = sprintf('out/%02d.html', $mfn );
-       open(my $fh, '>', $file) or die "can't open $file: $!";
-       print $fh $html;
-       close($fh);
-
-       $html =~ s#\s*[\n\r]+\s*##gs;
-
+#      my $html = $out->apply(
+#              template => 'html_ffzg.tt',
+#              data => $ds,
+#      );
+#
+#      # create test output
+#
+#      my $file = sprintf('out/%02d.html', $mfn );
+#      open(my $fh, '>', $file) or die "can't open $file: $!";
+#      print $fh $html;
+#      close($fh);
+#
+#      $html =~ s#\s*[\n\r]+\s*##gs;
+#
 #      print STDERR $html;
 
        $est->add(
@@ -93,4 +99,10 @@ while (my $row = $isis->fetch) {
                type => 'search',
        );
 
+       $total_rows++;
+
 };
+
+my $log = $lookup->_get_logger;
+
+$log->info("$total_rows records indexed");