Ignore:
Timestamp:
2009-12-07T13:15:56+13:00 (14 years ago)
Author:
kjdon
Message:

tidied up index method, added removeold method (not tested yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/PharosImageIndexer.pm

    r21220 r21283  
    9393}
    9494
     95sub removeold {
     96    my $self = shift (@_);
     97    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
     98   
     99    if (!$self->{'pharos_available'}) {
     100    print STDERR "pharos not available, not doing a removeold\n";
     101    }
     102    # need to delete everything from the derby database.
     103    my $collection = &util::get_current_collection_name();
     104    my $cmd = "perl -S pharos-imageis-delete.pl $collection *.jpg 2>&1";
     105    print STDERR "Running command $cmd\n";
     106    my $result = `$cmd`;
     107    my $return_value = $?;
     108    my $outhandle = $self->{'outhandle'};
     109    if ($return_value != 0) {
     110    print $outhandle "Pharos Indexing failed to clear database for collection $collection\n";
     111    }
     112    print $outhandle "$result\n";
     113   
     114}
     115
    95116sub pharos_index_image {
    96117    my $self = shift(@_);
     
    104125    my $id = $doc_obj->get_OID();
    105126
    106     #my $result = `pharos-imageis-add.pl $collection $filename_full_path $id 2>&1`;
    107     my $result = `imageis-add-jpg-file.sh $collection $filename_full_path 2>&1`;
     127    my $cmd = "perl -S pharos-imageis-add.pl $collection $filename_full_path $id 2>&1";
     128    print STDERR "Running command $cmd\n";
     129    my $result = `$cmd`;
     130
    108131    my $return_value = $?;
     132    my $outhandle = $self->{'outhandle'};
    109133    if ($return_value != 0) {
    110     my $outhandle = $self->{'outhandle'};
    111134    print $outhandle "Pharos Indexing failed for $filename_full_path, $id\n";
    112     print $outhandle "$result\n";
    113135    }
     136    print $outhandle "$result\n";
     137   
    114138}
    115139
Note: See TracChangeset for help on using the changeset viewer.