Changeset 33389

Show
Ignore:
Timestamp:
06.08.2019 13:19:16 (2 weeks 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.

Files:
1 modified

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