Index: gsdl/trunk/perllib/classify.pm
===================================================================
--- gsdl/trunk/perllib/classify.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify.pm	(revision 18455)
@@ -280,9 +280,9 @@
 # classify_doc lets each of the classifiers classify a document
 sub classify_doc {
-    my ($classifiers, $doc_obj) = @_;
+    my ($classifiers, $doc_obj, $edit_mode) = @_;
     
     foreach my $classobj (@$classifiers) {
 	my $title = $classobj->{'title'};
-	$classobj->classify($doc_obj);
+	$classobj->classify($doc_obj,$edit_mode);
     }
 }
Index: gsdl/trunk/perllib/classify/AZCompactList.pm
===================================================================
--- gsdl/trunk/perllib/classify/AZCompactList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/AZCompactList.pm	(revision 18455)
@@ -180,5 +180,5 @@
 {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
@@ -211,4 +211,16 @@
 	my $full_doc_OID 
 	    = ($thissection ne "") ? "$doc_OID.$thissection" : $doc_OID;
+
+	if ($edit_mode eq "delete") {
+	    print $outhandle "  Deleting $full_doc_OID\n";
+	    delete $self->{'list'}->{$full_doc_OID};
+	    delete $self->{'listmetavalue'}->{$full_doc_OID};
+	    delete $self->{'list_mvpair'}->{$full_doc_OID};
+	    delete $self->{'reclassify'}->{$full_doc_OID};
+
+	    next;
+	}
+
+
 	if (defined $self->{'list_mvpair'}->{$full_doc_OID}) 
 	{
@@ -486,10 +498,10 @@
 		if ($self->{'doclevel'} =~ m/^top/i) { # toplevel
 		    $self->{'classifiers'}->{$node_name}->{'classifyobj'}
-		    ->classify($doc_obj, "Section=$section");
+		    ->classify($doc_obj,"add", "Section=$section");
 		} else { # section level
 		    # Thanks to Don Gourley for this...
 		    # classify can't handle multi-level section
 		    $self->{'classifiers'}->{$node_name}->{'classifyobj'}
-		    ->classify_section($section, $doc_obj, $sortmeta);
+		    ->classify_section($section, $doc_obj, "add", $sortmeta);
 		}
 	    }
@@ -497,5 +509,5 @@
 	    {
 		$self->{'classifiers'}->{$node_name}->{'classifyobj'}
-		->classify($doc_obj); 
+		->classify($doc_obj,"add"); 
 	    }
 	} else { # this key is not in the hash
Index: gsdl/trunk/perllib/classify/AZList.pm
===================================================================
--- gsdl/trunk/perllib/classify/AZList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/AZList.pm	(revision 18455)
@@ -119,8 +119,13 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
     my $outhandle = $self->{'outhandle'};
+
+    if ($edit_mode eq "delete") {
+	$self->oid_hash_delete($doc_OID,'list');
+	return;
+    }
 
     my $metavalue;
Index: gsdl/trunk/perllib/classify/AZSectionList.pm
===================================================================
--- gsdl/trunk/perllib/classify/AZSectionList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/AZSectionList.pm	(revision 18455)
@@ -71,5 +71,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
@@ -77,5 +77,5 @@
 
     while (defined $thissection) {
-	$self->classify_section ($thissection, $doc_obj);
+	$self->classify_section ($thissection, $doc_obj, $edit_mode);
 	$thissection = $doc_obj->get_next_section ($thissection);
     }
@@ -84,7 +84,12 @@
 sub classify_section {
     my $self = shift (@_);
-    my ($section, $doc_obj) = @_;
+    my ($section, $doc_obj, $edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
+
+    if ($edit_mode eq "delete") {
+	$self->oid_hash_delete("$doc_OID$section",'list');
+	return;
+    }
 
     my $metavalue;
Index: gsdl/trunk/perllib/classify/AllList.pm
===================================================================
--- gsdl/trunk/perllib/classify/AllList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/AllList.pm	(revision 18455)
@@ -72,9 +72,14 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj, $edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
     
-    push (@{$self->{'list'}}, $doc_OID);
+    if ($edit_mode eq "delete") {
+	$self->oid_array_delete($doc_OID,'list');
+    }
+    else {
+	push (@{$self->{'list'}}, $doc_OID);
+    }
 
     return;
Index: gsdl/trunk/perllib/classify/BaseClassifier.pm
===================================================================
--- gsdl/trunk/perllib/classify/BaseClassifier.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/BaseClassifier.pm	(revision 18455)
@@ -298,7 +298,37 @@
 }
 
+sub oid_array_delete
+{
+    my $self = shift (@_);
+    my ($delete_oid,$field) = @_;
+
+    my $outhandle = $self->{'outhandle'};
+
+    my @filtered_list = ();
+    foreach my $existing_oid (@{$self->{$field}}) {
+	if ($existing_oid eq $delete_oid) {
+	    print $outhandle "  Deleting $delete_oid\n";
+	}
+	else {
+	    push(@filtered_list,$existing_oid);
+	}
+    }
+    $self->{$field} = \@filtered_list;
+}
+
+sub oid_hash_delete
+{
+    my $self = shift (@_);
+    my ($delete_oid,$field) = @_;
+
+    my $outhandle = $self->{'outhandle'};
+
+    print $outhandle "  Deleting $delete_oid\n";
+    delete $self->{$field}->{$delete_oid};
+}
+
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj, $edit_mode) = @_;
 
     my $outhandle = $self->{'outhandle'};
Index: gsdl/trunk/perllib/classify/Collage.pm
===================================================================
--- gsdl/trunk/perllib/classify/Collage.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/Collage.pm	(revision 18455)
@@ -139,5 +139,5 @@
    
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $has_image_type = 0;
@@ -159,6 +159,13 @@
 
     if ($has_image_type) {
+
 	my $doc_OID = $doc_obj->get_OID();
-	push (@{$self->{'list'}}, $doc_OID);
+
+	if ($edit_mode eq "delete") {
+	    $self->oid_array_delete($doc_OID,'list');
+	}
+	else {
+	    push (@{$self->{'list'}}, $doc_OID);
+	}
     }
 
Index: gsdl/trunk/perllib/classify/DateList.pm
===================================================================
--- gsdl/trunk/perllib/classify/DateList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/DateList.pm	(revision 18455)
@@ -129,5 +129,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj, $edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
@@ -147,4 +147,9 @@
     }
     
+    if ($edit_mode eq "delete") {
+	$self->oid_hash_delete($doc_OID,'list');
+	return;
+    }
+
     my $sort_other = "";
     if (defined $self->{'sort'} && $self->{'sort'} ne "") {
Index: gsdl/trunk/perllib/classify/GenericList.pm
===================================================================
--- gsdl/trunk/perllib/classify/GenericList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/GenericList.pm	(revision 18455)
@@ -194,5 +194,5 @@
 {
     my $self = shift(@_);
-    my $doc_obj = shift(@_);
+    my ($doc_obj,$edit_mode) = @_;
 
     # If "-classify_sections" is set, classify every section of the document
@@ -200,5 +200,5 @@
 	my $section = $doc_obj->get_next_section($doc_obj->get_top_section());
 	while (defined $section) {
-	    $self->classify_section($doc_obj, $doc_obj->get_OID() . ".$section", $section);
+	    $self->classify_section($doc_obj, $doc_obj->get_OID() . ".$section", $section, $edit_mode);
 	    $section = $doc_obj->get_next_section($section);
 	}
@@ -206,5 +206,5 @@
     # Otherwise just classify the top document section
     else {
-	$self->classify_section($doc_obj, $doc_obj->get_OID(), $doc_obj->get_top_section());
+	$self->classify_section($doc_obj, $doc_obj->get_OID(), $doc_obj->get_top_section(), $edit_mode);
     }
 }
@@ -214,7 +214,5 @@
 {
     my $self = shift(@_);
-    my $doc_obj = shift(@_);
-    my $section_OID = shift(@_);
-    my $section = shift(@_);
+    my ($doc_obj,$section_OID,$section,$edit_mode) = @_;
 
     my @metadata_groups = @{$self->{'metadata_groups'}};
@@ -235,4 +233,9 @@
     return if (!$classify_section);
 
+    if ($edit_mode eq "delete") {
+	$self->oid_array_delete($section_OID,'OIDs');
+	return;
+    }
+   
     # Otherwise, include this section in the classifier
     push(@{$self->{'OIDs'}}, $section_OID);
Index: gsdl/trunk/perllib/classify/HFileHierarchy.pm
===================================================================
--- gsdl/trunk/perllib/classify/HFileHierarchy.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/HFileHierarchy.pm	(revision 18455)
@@ -197,5 +197,7 @@
 {
     my $self = shift (@_);
-    my ($doc_obj,$sortmeta,$metavalues) = @_;
+    my ($doc_obj,$edit_mode,$sortmeta,$metavalues) = @_;
+
+    my $outhandle = $self->{'outhandle'};
 
     my $doc_OID = $doc_obj->get_OID();
@@ -204,10 +206,28 @@
 	if ((defined $self->{'descriptorlist'}->{$metaelement}) &&
 	    (defined $self->{'locatorlist'}->{$self->{'descriptorlist'}->{$metaelement}})) {
-	    push (@{$self->{'locatorlist'}->{$self->{'descriptorlist'}->{$metaelement}}->{'contents'}}, 
-		  [$doc_OID, $sortmeta]);
-	    my $localid = $self->{'descriptorlist'}->{$metaelement};
-	    my $classid = $self->get_number();
-
-	    $doc_obj->add_metadata($doc_obj->get_top_section(), "memberof", "CL$classid.$localid");
+
+	    if ($edit_mode eq "delete") {
+		# find it, and remove it
+		my $existing_list = $self->{'locatorlist'}->{$self->{'descriptorlist'}->{$metaelement}}->{'contents'};
+		
+		my $filtered_list = [];
+		foreach my $existing_oid_pair (@$existing_list) {
+		    if ($existing_oid_pair->[0] eq $doc_OID) {
+			print $outhandle "  Deleting $doc_OID for $metaelement in hierarchy\n";
+		    }
+		    else {
+			push(@$filtered_list,$existing_oid_pair);
+		    }
+		}
+		$self->{'locatorlist'}->{$self->{'descriptorlist'}->{$metaelement}}->{'contents'} = $filtered_list;
+	    }
+	    else {
+		push (@{$self->{'locatorlist'}->{$self->{'descriptorlist'}->{$metaelement}}->{'contents'}}, 
+		      [$doc_OID, $sortmeta]);
+		my $localid = $self->{'descriptorlist'}->{$metaelement};
+		my $classid = $self->get_number();
+
+		$doc_obj->add_metadata($doc_obj->get_top_section(), "memberof", "CL$classid.$localid");
+	    }
 	}
     }
Index: gsdl/trunk/perllib/classify/HTML.pm
===================================================================
--- gsdl/trunk/perllib/classify/HTML.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/HTML.pm	(revision 18455)
@@ -86,5 +86,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     # we don't do anything for individual documents
Index: gsdl/trunk/perllib/classify/Hierarchy.pm
===================================================================
--- gsdl/trunk/perllib/classify/Hierarchy.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/Hierarchy.pm	(revision 18455)
@@ -86,8 +86,18 @@
 sub auto_classify {
     my $self = shift (@_);
-    my ($doc_obj,$nosort,$sortmeta,$metavalues) = @_;
+    my ($doc_obj,$edit_mode,$nosort,$sortmeta,$metavalues) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
-    
+
+    if ($edit_mode eq "delete") {
+	if ($nosort) {
+	    $self->oid_array_delete($doc_OID,'docs');
+	}
+	else {
+	    $self->oid_hash_delete($doc_OID,'docs');
+	}
+	return;
+    }
+
     #Add all the metadata values to the hash
     my $path_hash;
@@ -133,5 +143,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
@@ -175,8 +185,8 @@
 
     if (defined $self->{'subjectfile'}) {
-	$self->hfile_classify($doc_obj,$sortmeta,$metavalues);
+	$self->hfile_classify($doc_obj,$edit_mode,$sortmeta,$metavalues);
     }
     else {
-	$self->auto_classify($doc_obj,$nosort,$sortmeta,$metavalues);
+	$self->auto_classify($doc_obj,$edit_mode,$nosort,$sortmeta,$metavalues);
     }
 }
Index: gsdl/trunk/perllib/classify/List.pm
===================================================================
--- gsdl/trunk/perllib/classify/List.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/List.pm	(revision 18455)
@@ -123,7 +123,8 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj, $edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
+
 
     # are we sorting the list??
@@ -133,4 +134,14 @@
     }
     
+    if ($edit_mode eq "delete") {
+	if ($nosort) {
+	    $self->oid_array_delete($doc_OID,'list');
+	}
+	else {
+	    $self->oid_hash_delete($doc_OID,'list');
+	}
+	return;
+    }
+
     my $metavalue;
     my $metaname;
Index: gsdl/trunk/perllib/classify/Phind.pm
===================================================================
--- gsdl/trunk/perllib/classify/Phind.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/Phind.pm	(revision 18455)
@@ -242,5 +242,5 @@
 sub classify {
     my $self = shift (@_);
-    my $doc_obj = shift @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $verbosity = $self->{'verbosity'};
@@ -260,5 +260,11 @@
     my $phrlanguage = $self->{'language'};
     return if ($doclanguage && ($doclanguage !~ /$phrlanguage/i));
-    
+
+    if ($edit_mode eq "delete") {
+	# This classifier works quite differently to the others
+	# Probably doesn't support incremental building anyway
+	return;
+    }
+
     # record this file
     $self->{'total'} ++;
Index: gsdl/trunk/perllib/classify/RecentDocumentsList.pm
===================================================================
--- gsdl/trunk/perllib/classify/RecentDocumentsList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/RecentDocumentsList.pm	(revision 18455)
@@ -124,5 +124,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj) = @_;
+    my ($doc_obj,$edit_mode) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
@@ -130,4 +130,9 @@
     if (!defined $lastmodified || $lastmodified eq "") {
 	print $self->{'outhandle'}, "RecentDocumentsList: $doc_OID has no lastmodified metadata, not classifying\n";
+	return;
+    }
+
+    if ($edit_mode eq "delete") {
+	$self->oid_hash_delete($doc_OID,'list');
 	return;
     }
Index: gsdl/trunk/perllib/classify/SectionList.pm
===================================================================
--- gsdl/trunk/perllib/classify/SectionList.pm	(revision 18451)
+++ gsdl/trunk/perllib/classify/SectionList.pm	(revision 18455)
@@ -63,5 +63,5 @@
 sub classify {
     my $self = shift (@_);
-    my ($doc_obj, @options) = @_;
+    my ($doc_obj, $edit_mode, @options) = @_;
     
     # @options used by AZCompactList when is uses SectionList internally
@@ -97,10 +97,10 @@
     if (defined $thissection) {
 	# just classify the one section
-	$self->classify_section($thissection, $doc_obj, $sortmeta, $nosort);
+	$self->classify_section($thissection, $doc_obj, $edit_mode, $sortmeta, $nosort);
     } else    
     {
 	$thissection = $doc_obj->get_next_section ($doc_obj->get_top_section());
 	while (defined $thissection) {
-	    $self->classify_section($thissection, $doc_obj, $sortmeta, $nosort);
+	    $self->classify_section($thissection, $doc_obj, $edit_mode, $sortmeta, $nosort);
 	    $thissection = $doc_obj->get_next_section ($thissection);
 	}
@@ -110,5 +110,5 @@
 sub classify_section {
     my $self = shift (@_);
-    my ($section, $doc_obj, $sortmeta, $nosort) = @_;
+    my ($section, $doc_obj, $edit_mode, $sortmeta, $nosort) = @_;
 
     my $doc_OID = $doc_obj->get_OID();
