minor tweak for database routines, run.pl now iterates through all entries
(to fix problem with stopping at first deleted entry)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@113
07558da8-63fa-0310-ba24-
9fe276d99e06
$log->logdie("save_ds without cache_file -- did you called gs_get before?") unless ($self->{'cache_file'});
- foreach my $e (qw/ds current_filename headline/) {
- $log->warn("missing $e") unless $arg->{$e};
+ $log->logdie("need ds") unless ($arg->{ds});
+
+ foreach my $e (qw/current_filename headline/) {
+ my $mfn = $arg->{ds}->{000}->[0] || '?';
+ $log->warn("missing $e in record $mfn") unless $arg->{$e};
}
$log->debug("creating storable cache file ",$self->{'cache_file'});
$log->logdie("hum? implementation missing?");
}
- $log->confess("record $mfn empty?") unless ($rec);
+ if (! $rec) {
+ $log->warn("record $mfn empty? skipping...");
+ next;
+ }
# store
if ($self->{'low_mem'}) {
$self->progress_bar($mfn,$self->{'max_mfn'});
+ my $rec;
+
if ($self->{'low_mem'}) {
- return $self->{'db'}->get($mfn);
+ $rec = $self->{'db'}->get($mfn);
} else {
- return $self->{'data'}->{$mfn};
+ $rec = $self->{'data'}->{$mfn};
}
+
+ $rec ||= 0E0;
}
=head2 pos
# filter all tags which have type defined
my @tags = grep {
- defined( $args->{'ds'}->{$_}->{$type} )
+ ref($args->{'ds'}->{$_}) eq 'HASH' && defined( $args->{'ds'}->{$_}->{$type} )
} keys %{ $args->{'ds'} };
$log->debug("tags = ", join(",", @tags));
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";
# 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(
type => 'search',
);
+ $total_rows++;
+
};
+
+my $log = $lookup->_get_logger;
+
+$log->info("$total_rows records indexed");