Ignore:
Timestamp:
2009-02-03T09:48:19+13:00 (15 years ago)
Author:
davidb
Message:

Additions to support the deleting of documents from the index. Only works for indexers that support incremental building, e.g. lucene

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm

    r18441 r18456  
    8787    my ($self) = @_;
    8888
    89     print STDERR "*** Running ArchivesInf deinit\n";
    90 
    9189    my $archive_info = $self->{'archive_info'};
    9290
    9391    if (defined $archive_info) {
     92    print STDERR "********* have parsed and processed an archive info file\n";
     93
    9494    my $archive_info_filename = $self->{'archive_info_filename'};
    9595
    9696        my $file_list = $archive_info->get_file_list();
    9797
    98     foreach my $subfile (@$file_list) {
     98    foreach my $subfile (@$file_list) {     
    9999        my $doc_oid = $subfile->[1];
    100100
    101101        my $index_status = $archive_info->get_status_info($doc_oid);
     102        print STDERR "*** Updating $doc_oid $index_status\n";
     103
    102104        if ($index_status eq "D") {
    103105        # delete
     
    203205        my $tmp = &util::filename_cat ($file, $subfile->[0]);
    204206        next if $tmp eq $file;
    205        
    206         # We always process the file...
     207
     208        my $doc_oid = $subfile->[1];
     209        my $index_status = $archive_info->get_status_info($doc_oid);
     210
     211        my $curr_mode = $processor->get_mode();
     212        my $new_mode = $curr_mode;
     213
     214        # Start by assuming we want to process the file...
    207215        my $process_file = 1;
    208216
     
    211219        {
    212220            # Check to see if the file needs indexing
    213         my $doc_oid = $subfile->[1];
    214         my $index_status = $archive_info->get_status_info($doc_oid);
    215221        if ($index_status eq "B")
    216222        {
     
    218224            $process_file = 0;
    219225        }
     226        elsif ($index_status eq "D") {
     227            # Need to be delete it from the index.
     228            $new_mode = $curr_mode."delete";
     229            $process_file = 1;
     230        }
     231        elsif ($index_status eq "R") {
     232            # Need to be delete it from the index.
     233            $new_mode = $curr_mode."reindex";
     234            $process_file = 1;
     235        }
     236        }
     237        # ... or we're being asked to delete it (in which case skip it)
     238        elsif ($index_status eq "D") {
     239        # Delete it somehow from archives dir!!
     240        # => get short name, lop off filename, concat archivedir
     241        # move to recyle bin
     242
     243        $process_file = 0;
    220244        }
    221245
    222246        if ($process_file) {
    223247        # note: metadata is not carried on to the next level
     248       
     249        $processor->set_mode($new_mode) if ($new_mode ne $curr_mode);
     250
    224251        $count += &plugin::read ($pluginfo, $base_dir, $tmp, $block_hash, {}, $processor, $maxdocs, ($total_count+$count), $gli);
    225         }
    226 
     252
     253        $processor->set_mode($curr_mode) if ($new_mode ne $curr_mode);
     254        }
    227255    }
    228256
Note: See TracChangeset for help on using the changeset viewer.