Ignore:
Timestamp:
2010-10-12T13:55:07+13:00 (14 years ago)
Author:
kjdon
Message:

for incremental build, classifiers are not really done incrementally. Previously, we reconstructed all the docs from the database, and classified them, then processed any new/edited/deleted docs, updating the classifier as necessary. Now, we process all new/updated docs, then reconstruct the docs from the database, but only classify those not changed/deleted. This means that we are only ever adding docs to a classifier, never updating or deleting. I have removed edit_mode and all code handling deleting stuff from the classifier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/classify/List.pm

    r22667 r23116  
    290290{
    291291    my $self = shift(@_);
    292     my ($doc_obj,$edit_mode) = @_;
     292    my ($doc_obj) = @_;
    293293
    294294    # If "-classify_sections" is set, classify every section of the document
     
    296296    my $section = $doc_obj->get_next_section($doc_obj->get_top_section());
    297297    while (defined $section) {
    298         $self->classify_section($doc_obj, $doc_obj->get_OID() . ".$section", $section, $edit_mode);
     298        $self->classify_section($doc_obj, $doc_obj->get_OID() . ".$section", $section);
    299299        $section = $doc_obj->get_next_section($section);
    300300    }
     
    302302    # Otherwise just classify the top document section
    303303    else {
    304     $self->classify_section($doc_obj, $doc_obj->get_OID(), $doc_obj->get_top_section(), $edit_mode);
     304    $self->classify_section($doc_obj, $doc_obj->get_OID(), $doc_obj->get_top_section());
    305305    }
    306306}
     
    310310{
    311311    my $self = shift(@_);
    312     my ($doc_obj,$section_OID,$section,$edit_mode) = @_;
     312    my ($doc_obj,$section_OID,$section) = @_;
    313313
    314314    my @metadata_groups = @{$self->{'metadata_groups'}};
     
    342342    # We're not classifying this section because it doesn't have the required metadata
    343343    return if (!$classify_section);
    344 
    345     if (($edit_mode eq "delete") || ($edit_mode eq "update")) {
    346     $self->oid_array_delete($section_OID,'OIDs');
    347     if ($edit_mode eq "delete") {
    348         return;
    349     }
    350     }
    351344   
    352345    # Otherwise, include this section in the classifier
     
    358351    # Take care not to do a metadata group more than once
    359352    unless ($metadata_groups_done{$metadata_group}) {
    360         if ($edit_mode eq "update") {
    361         # if we are updating, we delete all the old values before
    362         # adding the new ones, otherwise, the section will end up in
    363         # the classifier twice.
    364         delete $self->{$metadata_group . ".list"}->{$section_OID};
    365         }
    366 
    367353        my $remove_prefix_expr = $self->{$metadata_group . ".remove_prefix_expr"};
    368354        my $remove_suffix_expr = $self->{$metadata_group . ".remove_suffix_expr"};
Note: See TracChangeset for help on using the changeset viewer.