Changeset 23121 for main/trunk


Ignore:
Timestamp:
2010-10-12T14:05:25+13:00 (14 years ago)
Author:
kjdon
Message:

small changes based on the fact that we need to store ids for updated and deleted documents so the reconstructed documents don't get processed later

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/basebuildproc.pm

    r22843 r23121  
    416416    }
    417417
    418     if (($edit_mode eq "add")) {# || ($edit_mode eq "update")) {
     418    if (($edit_mode eq "add") || ($edit_mode eq "update")) {
    419419    #add this document to the browse structure
    420420    push(@{$self->{'doclist'}},$doc_obj->get_OID())
    421421        unless ($doctype eq "classification");
    422     }
    423 #    elsif ($edit_mode eq "update") {
    424     # don't do anything. this assumes it will keep the same id.
    425 #    }
     422    if ($edit_mode eq "update") {
     423        $self->{'dont_reconstruct'}->{$doc_obj->get_OID()} = 1;
     424    }
     425    &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
     426    $self->{'num_docs'} += 1 unless ($doctype eq "classification");
     427    }
    426428    elsif ($edit_mode eq "delete") {
    427     # delete => remove this doc from browse structure
     429    # record this doc so we don't process the reconstructed doc later
    428430    my $del_doc_oid = $doc_obj->get_OID();
    429 
    430     my @filtered_doc_list = ();
    431     foreach my $oid (@{$self->{'doclist'}}) {
    432         push(@filtered_doc_list,$oid) if ($oid ne $del_doc_oid);
    433     }
    434     $self->{'doclist'} = \@filtered_doc_list;
    435     }
    436 
    437 
    438     # classify this document
    439     &classify::classify_doc ($self->{'classifiers'}, $doc_obj, $edit_mode);
    440 
    441     if (($edit_mode eq "add")) {# || ($edit_mode eq "update")) {
    442     # this is another document
    443     $self->{'num_docs'} += 1 unless ($doctype eq "classification");
    444     }
    445     elsif ($edit_mode eq "delete") {
    446     # delete
     431    $self->{'dont_reconstruct'}->{$del_doc_oid} = 1;
     432    # do we need this??? where did num_docs come from, from reconstruction??
    447433    $self->{'num_docs'} -= 1 unless ($doctype eq "classification");
    448434    }
Note: See TracChangeset for help on using the changeset viewer.