r523@llin: dpavlin | 2006-04-17 17:18:35 +0200
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 17 Apr 2006 16:01:02 +0000 (16:01 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 17 Apr 2006 16:01:02 +0000 (16:01 +0000)
 warn about missing fields when inserting into index

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

lib/WebPAC/Output/KinoSearch.pm

index dbcd236..8e25eaf 100644 (file)
@@ -154,7 +154,14 @@ sub add {
        $log->debug("creating $uri");
 
        my $doc = $self->{invindex}->new_doc( $uri ) || $log->logdie("can't create new_doc( $uri )");
-       eval { $doc->set_value('uri', $self->convert($uri) ) };
+
+       sub add_value($$) {
+               my ($n,$v) = @_;
+               eval { $doc->set_value($n, $self->convert($v) ) };
+               $log->warn("can't insert: $n = $v") if ($@);
+       }
+
+       add_value('uri', $uri);
 
        $log->debug("ds = ", sub { Dumper($args->{'ds'}) } );
 
@@ -176,14 +183,11 @@ sub add {
                $vals = $self->convert( $vals ) or
                        $log->logdie("can't convert '$vals' to UTF-8");
 
-               eval { $doc->set_value( $tag, $vals ) };
+               add_value( $tag, $vals );
        }
 
-       my $text = $args->{'text'};
-       if ( $text ) {
-               $text = $self->convert( $text ) or
-                       $log->logdie("can't convert '$text' to UTF-8");
-               eval { $doc->set_value( bodytext => $text ) };
+       if (my $text = $args->{'text'}) {
+               add_value( 'bodytext', $text );
        }
 
        #$log->debug("adding ", sub { $doc->dump_draft } );