--- trunk/lib/WebPAC/Output/KinoSearch.pm 2007/10/30 21:57:36 917 +++ trunk/lib/WebPAC/Output/KinoSearch.pm 2007/10/30 22:07:11 919 @@ -25,11 +25,11 @@ =head1 VERSION -Version 0.04 +Version 0.05 =cut -our $VERSION = '0.04'; +our $VERSION = '0.05'; =head1 SYNOPSIS @@ -93,6 +93,10 @@ if ( ! -e $self->path ) { mkpath $self->path || $log->logdie("can't create ", $self->path,": $!"); $log->info("created ", $self->path); + } elsif ( $self->clean ) { + $log->info("removing existing ", $self->path); + rmtree $self->path || $log->logdie("can't remove ", $self->path,": $!"); + mkpath $self->path || $log->logdie("can't create ", $self->path,": $!"); } my $path = $self->path . '/' . $self->database; @@ -132,7 +136,10 @@ my $hash = $self->ds_to_hash( $ds, 'search' ) || return; - warn "add( $id, ",dump($ds)," ) => ", dump( $hash ); + $hash->{database} ||= $self->database; + $hash->{id} ||= $id; + + $log->debug("add( $id, ", sub { dump($ds) }," ) => ", sub { dump( $hash ) }); $self->index->add_doc( $hash );