r1419@llin: dpavlin | 2007-10-31 13:29:55 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 31 Oct 2007 12:29:57 +0000 (12:29 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 31 Oct 2007 12:29:57 +0000 (12:29 +0000)
 - added input to indexed data
 - clean index on every invocation (should be incremental in future)

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

lib/WebPAC/Output/KinoSearch.pm

index cb48b06..200ea4a 100644 (file)
@@ -7,6 +7,7 @@ use base qw/WebPAC::Common WebPAC::Output Class::Accessor/;
 __PACKAGE__->mk_accessors(qw(
        path
        database
+       input
        encoding
        clean
 
@@ -90,6 +91,9 @@ sub init {
 
        $self->encoding( 'ISO-8859-2' ) unless $self->encoding;
 
+       ## FIXME we shouldn't re-create whole KinoSearch index every time!
+       $self->clean( 1 );
+
        if ( ! -e $self->path ) {
                mkpath $self->path || $log->logdie("can't create ", $self->path,": $!");
                $log->info("created ", $self->path);
@@ -136,8 +140,9 @@ sub add {
 
        my $hash = $self->ds_to_hash( $ds, 'search' ) || return;
 
+       $hash->{id}       ||= $id;
        $hash->{database} ||= $self->database;
-       $hash->{id} ||= $id;
+       $hash->{input}    ||= $self->input;
 
        foreach my $f ( keys %$hash ) {
                if ( ref($hash->{$f}) eq 'ARRAY' ) {