=head1 VERSION
-Version 0.04
+Version 0.05
=cut
-our $VERSION = '0.04';
+our $VERSION = '0.05';
=head1 SYNOPSIS
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;
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 );
#!/usr/bin/perl -w
-use Test::More tests => 14;
+use Test::More tests => 20;
use Test::Exception;
use Cwd qw/abs_path/;
use KinoSearch;
ok(my $out = new WebPAC::Output::KinoSearch({
path => $path,
database => 'test',
+ clean => 1,
+ debug => $debug,
}), "new");
ok( $out->init, 'init' );
diag "Total hits: $total_hits\n";
while ( my $hit = $index->fetch_hit_hashref ) {
+ ok( $hit, 'hit' );
diag dump($hit);
}