Changeset 20651 for gsdl/trunk


Ignore:
Timestamp:
2009-09-21T13:35:55+12:00 (15 years ago)
Author:
davidb
Message:

Updated to support incremental exporting

Location:
gsdl/trunk/perllib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/expinfo.pm

    r15894 r20651  
    105105sub add_info {
    106106    my $self = shift (@_);
    107     my ($OID, $doc_file, $sortmeta) = @_;
     107    my ($OID, $doc_file, $index_status, $sortmeta) = @_;
    108108    $sortmeta = "" unless defined $sortmeta;
    109109
     
    112112    return undef;
    113113    }
    114     $self->delete_info ($OID);
    115     $self->{'info'}->{$OID} = [$doc_file];
     114
     115    print STDERR "**** adding info $OID\n";
     116
     117    if (defined $self->{'info'}->{$OID}) {
     118    # test to see if we are in a reindex situation
     119
     120    my $existing_status_info = $self->get_status_info($OID);
     121
     122    if ($existing_status_info eq "D") {
     123        # yes, we're in a reindexing situation
     124        $self->delete_info ($OID);
     125
     126
     127        # force setting to "reindex"
     128        $index_status = "R";
     129
     130    }
     131    else {
     132        # some other, possibly erroneous, situation has arisen
     133        # where the document already seems to exist
     134        print STDERR "Warning: $OID already exists with index status $existing_status_info\n";
     135        print STDERR "         Deleting previous version\n";
     136
     137        $self->delete_info ($OID);
     138    }
     139    }
     140
     141    $self->{'info'}->{$OID} = [$doc_file,$index_status];
    116142    push (@{$self->{'order'}}, [$OID, $sortmeta]);
    117143}
  • gsdl/trunk/perllib/plugouts/BasePlugout.pm

    r20320 r20651  
    722722    my $working_info = $self->{'output_info'};
    723723    my $doc_info = $working_info->get_info($oid);
     724
    724725    my ($doc_file,$index_status) = @$doc_info;
    725726
     
    736737                     $collect_dir,$oid_files,$reverse_lookups);
    737738
    738 # *******
    739 #    foreach my $assoc_file_rec (@{$doc_obj->get_assoc_files()}) {
    740 #   my $real_filename = $assoc_file_rec->[0];
    741 #   my $full_afile = $assoc_file_rec->[1];
    742 #
    743 #   # for some reasons the image associate file has / before the full path
    744 #   $real_filename =~ s/^\\(.*)/$1/i;
    745 #   if (-e $real_filename) {
    746 #
    747 #       if (defined $collect_dir) {
    748 #       my $collect_dir_re_safe = $collect_dir;
    749 #       $collect_dir_re_safe =~ s/\\/\\\\/g;
    750 #       $collect_dir_re_safe =~ s/\./\\./g;
    751 #
    752 #       $real_filename =~ s/^$collect_dir_re_safe//;
    753 #       }
    754 #
    755 #       $reverse_lookups->{$real_filename} = 1;
    756 #
    757 #       push(@{$oid_files->{'assoc-file'}},$full_afile);
    758 #   }
    759 #   else {
    760 #       print STDERR "Warning: archiveinf_gdbm()\n  $real_filename does not appear to be on the file system\n";
    761 #   }
    762 #    }
    763739
    764740    $self->archiveinf_files_to_field($doc_obj->get_meta_files(),"meta-file",
     
    773749    my $doc_db = &util::filename_cat($output_dir,"archiveinf-doc.gdb");
    774750    my $src_db = &util::filename_cat($output_dir,"archiveinf-src.gdb");
    775 
    776 #    my $doc_db_text = "";
    777 #    $doc_db_text .= "<doc-file>$oid_files->{'doc-file'}\n";
    778 #    $doc_db_text .= "<index-status>$oid_files->{'index-status'}\n";
    779 #    $doc_db_text .= "<src-file>$oid_files->{'src-file'}\n";
    780 
    781 #    foreach my $af (@{$oid_files->{'assoc-file'}}) {
    782 #   $doc_db_text .= "<assoc-file>$af\n";
    783 #    }
    784 
    785 #    foreach my $mf (@{$oid_files->{'meta-file'}}) {
    786 #   $doc_db_text .= "<meta-file>$mf\n";
    787 #    }
    788 
    789 #    chomp($doc_db_text); # remove trailing \n
    790751
    791752    ##print STDERR "*** To set in db: \n\t$doc_db\n\t$oid\n\t$doc_db_text\n";
  • gsdl/trunk/perllib/plugouts/MARCXMLPlugout.pm

    r20321 r20651  
    100100    }
    101101   
    102  
     102    $self->process_metafiles_metadata ($doc_obj);
     103
    103104    my $output_dir = $self->get_output_dir();
    104105    &util::mk_all_dir ($output_dir) unless -e $output_dir;
     
    117118    $self->output_xml_footer($outhandler,"MARCXML"); 
    118119    $self->close_xslt_pipe();
    119              
     120
     121    $self->{'short_doc_file'} = util::filename_cat ($doc_dir, "marc.xml"); 
     122
     123    $self->store_output_info_reference($doc_obj);             
    120124}
    121125
Note: See TracChangeset for help on using the changeset viewer.