Changeset 12873


Ignore:
Timestamp:
2006-09-27T16:38:41+12:00 (18 years ago)
Author:
mdewsnip
Message:

Can now obtain multiple documents for a record (and assign the metadata to each) if there are multiple values for -document_field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/explode_metadata_database.pl

    r12706 r12873  
    177177    ($language, $input_encoding) = $plugobj->textcat_get_language_encoding ($filename);
    178178    }
     179
    179180    my $text = "";
    180181    # Use the plugin's read_file function to avoid duplicating code
     
    230231        foreach my $pair (@$record_metadata) {
    231232        my ($field, $value) = (@$pair);
    232        
     233
    233234        # Does this metadata element specify a document to obtain?
    234235        if ($field eq $document_field) {
    235236            my $document_file_full = $document_prefix . $value . $document_suffix;
    236237            $document_file = &obtain_document($document_file_full, $documents_directory, $verbosity);
     238            &write_metadata_xml_file_entry(METADATA_XML_FILE, $document_file, $record_metadata, $metadata_set);
    237239        }
    238240        }
    239241    }
    240     # do we need to create a dummy doc??
     242    # Create a dummy .nul file if we haven't obtained any documents for this record
    241243    if (not defined $document_file) {
    242244        $document_file = sprintf("%8.8d", $record_number) . ".nul";
    243245        open(DUMMY_FILE, ">$documents_directory/$document_file");
    244246        close(DUMMY_FILE);
    245     }
    246 
    247     &write_metadata_xml_file_entry(METADATA_XML_FILE, $document_file, $record_metadata, $metadata_set);
     247        &write_metadata_xml_file_entry(METADATA_XML_FILE, $document_file, $record_metadata, $metadata_set);
     248    }
    248249
    249250    if (($record_number % $records_per_folder) == 0 || $record_number == scalar(@metadata_records)) {
Note: See TracChangeset for help on using the changeset viewer.