Index: /gsdl/trunk/perllib/expinfo.pm
===================================================================
--- /gsdl/trunk/perllib/expinfo.pm	(revision 20650)
+++ /gsdl/trunk/perllib/expinfo.pm	(revision 20651)
@@ -105,5 +105,5 @@
 sub add_info {
     my $self = shift (@_);
-    my ($OID, $doc_file, $sortmeta) = @_;
+    my ($OID, $doc_file, $index_status, $sortmeta) = @_;
     $sortmeta = "" unless defined $sortmeta;
 
@@ -112,6 +112,32 @@
 	return undef;
     }
-    $self->delete_info ($OID);
-    $self->{'info'}->{$OID} = [$doc_file];
+
+    print STDERR "**** adding info $OID\n";
+
+    if (defined $self->{'info'}->{$OID}) {
+	# test to see if we are in a reindex situation
+
+	my $existing_status_info = $self->get_status_info($OID);
+
+	if ($existing_status_info eq "D") {
+	    # yes, we're in a reindexing situation
+	    $self->delete_info ($OID);
+
+
+	    # force setting to "reindex"
+	    $index_status = "R";
+
+	}
+	else {
+	    # some other, possibly erroneous, situation has arisen
+	    # where the document already seems to exist
+	    print STDERR "Warning: $OID already exists with index status $existing_status_info\n";
+	    print STDERR "         Deleting previous version\n";
+
+	    $self->delete_info ($OID);
+	}
+    }
+
+    $self->{'info'}->{$OID} = [$doc_file,$index_status];
     push (@{$self->{'order'}}, [$OID, $sortmeta]);
 }
Index: /gsdl/trunk/perllib/plugouts/BasePlugout.pm
===================================================================
--- /gsdl/trunk/perllib/plugouts/BasePlugout.pm	(revision 20650)
+++ /gsdl/trunk/perllib/plugouts/BasePlugout.pm	(revision 20651)
@@ -722,4 +722,5 @@
     my $working_info = $self->{'output_info'}; 
     my $doc_info = $working_info->get_info($oid);
+
     my ($doc_file,$index_status) = @$doc_info;
 
@@ -736,29 +737,4 @@
 				     $collect_dir,$oid_files,$reverse_lookups);
 
-# ******* 
-#    foreach my $assoc_file_rec (@{$doc_obj->get_assoc_files()}) {
-#	my $real_filename = $assoc_file_rec->[0];
-#	my $full_afile = $assoc_file_rec->[1];
-#
-#	# for some reasons the image associate file has / before the full path
-#	$real_filename =~ s/^\\(.*)/$1/i;
-#	if (-e $real_filename) {
-#
-#	    if (defined $collect_dir) {
-#		my $collect_dir_re_safe = $collect_dir;
-#		$collect_dir_re_safe =~ s/\\/\\\\/g;
-#		$collect_dir_re_safe =~ s/\./\\./g;
-#
-#		$real_filename =~ s/^$collect_dir_re_safe//;
-#	    }
-#
-#	    $reverse_lookups->{$real_filename} = 1;
-#
-#	    push(@{$oid_files->{'assoc-file'}},$full_afile);
-#	}
-#	else {
-#	    print STDERR "Warning: archiveinf_gdbm()\n  $real_filename does not appear to be on the file system\n";
-#	}
-#    }
 
     $self->archiveinf_files_to_field($doc_obj->get_meta_files(),"meta-file",
@@ -773,19 +749,4 @@
     my $doc_db = &util::filename_cat($output_dir,"archiveinf-doc.gdb");
     my $src_db = &util::filename_cat($output_dir,"archiveinf-src.gdb");
-
-#    my $doc_db_text = "";
-#    $doc_db_text .= "<doc-file>$oid_files->{'doc-file'}\n";
-#    $doc_db_text .= "<index-status>$oid_files->{'index-status'}\n";
-#    $doc_db_text .= "<src-file>$oid_files->{'src-file'}\n";
-
-#    foreach my $af (@{$oid_files->{'assoc-file'}}) {
-#	$doc_db_text .= "<assoc-file>$af\n";
-#    }
-
-#    foreach my $mf (@{$oid_files->{'meta-file'}}) {
-#	$doc_db_text .= "<meta-file>$mf\n";
-#    }
-
-#    chomp($doc_db_text); # remove trailing \n
 
     ##print STDERR "*** To set in db: \n\t$doc_db\n\t$oid\n\t$doc_db_text\n";
Index: /gsdl/trunk/perllib/plugouts/MARCXMLPlugout.pm
===================================================================
--- /gsdl/trunk/perllib/plugouts/MARCXMLPlugout.pm	(revision 20650)
+++ /gsdl/trunk/perllib/plugouts/MARCXMLPlugout.pm	(revision 20651)
@@ -100,5 +100,6 @@
     }
     
- 
+    $self->process_metafiles_metadata ($doc_obj);
+
     my $output_dir = $self->get_output_dir();
     &util::mk_all_dir ($output_dir) unless -e $output_dir;
@@ -117,5 +118,8 @@
     $self->output_xml_footer($outhandler,"MARCXML");  
     $self->close_xslt_pipe(); 
-              
+
+    $self->{'short_doc_file'} = util::filename_cat ($doc_dir, "marc.xml");  
+
+    $self->store_output_info_reference($doc_obj);              
 }
 
