/[webpac2]/trunk/lib/WebPAC/Output/KinoSearch.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Output/KinoSearch.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 431 by dpavlin, Mon Apr 17 15:10:04 2006 UTC revision 437 by dpavlin, Sun Apr 30 19:06:09 2006 UTC
# Line 154  sub add { Line 154  sub add {
154          $log->debug("creating $uri");          $log->debug("creating $uri");
155    
156          my $doc = $self->{invindex}->new_doc( $uri ) || $log->logdie("can't create new_doc( $uri )");          my $doc = $self->{invindex}->new_doc( $uri ) || $log->logdie("can't create new_doc( $uri )");
157          eval { $doc->set_value('uri', $self->convert($uri) ) };  
158            sub add_value($$$$$) {
159                    my ($self,$log,$doc,$n,$v) = @_;
160                    return unless ($v);
161                    eval { $doc->set_value($n, $self->convert($v) ) };
162                    $log->warn("can't insert: $n = $v") if ($@);
163            }
164    
165            add_value($self,$log,$doc, 'uri', $uri);
166    
167          $log->debug("ds = ", sub { Dumper($args->{'ds'}) } );          $log->debug("ds = ", sub { Dumper($args->{'ds'}) } );
168    
# Line 176  sub add { Line 184  sub add {
184                  $vals = $self->convert( $vals ) or                  $vals = $self->convert( $vals ) or
185                          $log->logdie("can't convert '$vals' to UTF-8");                          $log->logdie("can't convert '$vals' to UTF-8");
186    
187                  eval { $doc->set_value( $tag, $vals ) };                  add_value($self, $log, $doc, $tag, $vals );
188          }          }
189    
190          my $text = $args->{'text'};          if (my $text = $args->{'text'}) {
191          if ( $text ) {                  add_value($self, $log, $doc, 'bodytext', $text );
                 $text = $self->convert( $text ) or  
                         $log->logdie("can't convert '$text' to UTF-8");  
                 eval { $doc->set_value( bodytext => $text ) };  
192          }          }
193    
194          #$log->debug("adding ", sub { $doc->dump_draft } );          #$log->debug("adding ", sub { $doc->dump_draft } );
# Line 192  sub add { Line 197  sub add {
197          return 1;          return 1;
198  }  }
199    
200    =head2 finish
201    
202    Close index
203    
204     $index->finish;
205    
206    =cut
207    
208    sub finish {
209            my $self = shift;
210    
211            $self->_get_logger()->info("finish index writing to disk");
212            $self->{invindex}->finish;
213    }
214    
215  =head2 convert  =head2 convert
216    

Legend:
Removed from v.431  
changed lines
  Added in v.437

  ViewVC Help
Powered by ViewVC 1.1.26