Changeset 33389 for main/trunk


Ignore:
Timestamp:
2019-08-06T13:19:16+12:00 (5 years ago)
Author:
kjdon
Message:

store csv field array associated with filename, because you might have 2 csv files with different field lists. The field list is created in metadata_read pass, and used in read pass.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/CSVPlugin.pm

    r31492 r33389  
    130130    }
    131131    }
    132     $self->{'csv_file_fields'} = \@csv_file_fields;
     132
     133    $self->{'csv_file_fields'}->{$filename} = \@csv_file_fields;
     134    ###print STDERR "**** CSV file fields joined ($filename) = ", join(" ||| ", @{$self->{'csv_file_fields'}->{$filename}}), "\n";
    133135}
    134136
     
    142144    my $section = $doc_obj->get_top_section();
    143145    my $csv_line = $$textref;
    144     my @csv_file_fields = @{$self->{'csv_file_fields'}};
    145146
    146     # Add the raw line as the document text
     147    my $filename_full_path = &FileUtils::filenameConcatenate($base_dir,$file);
     148    my @csv_file_fields = @{$self->{'csv_file_fields'}->{$filename_full_path}};
     149
     150    ###print STDERR "**** CSV file fields joined = ", join(" ||| ", @csv_file_fields), "\n";
     151
     152     # Add the raw line as the document text
    147153    $doc_obj->add_utf8_text($section, $csv_line);
    148154
Note: See TracChangeset for help on using the changeset viewer.