Changeset 29045

Show
Ignore:
Timestamp:
08.05.2014 17:59:47 (5 years ago)
Author:
ak19
Message:

Kathy suggested that the GS3 buildConfig.xml generated from GS2 build.cfg should ideally have the same content as if buildConfig.xml generated from a rebuild of the collection. This is so that a collection converted from GS2 to GS3 can be immediately previewed without rebuilding. Although immediate previewing already worked, the intention is to nevertheless make the automatically-generated buildConfig.xml file as identical as possible to the one generated upon a rebuild.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/bin/script/convert_coll_from_gs2.pl

    r29008 r29045  
    127127    $indexstem = $buildcfg->{'indexstem'}; 
    128128    } 
     129    #my $indexstem = $buildcfg->{'indexstem'} || undef; 
     130    my $infodbtype = $buildcfg->{'infodbtype'} || "gdbm"; 
     131    my $earliestDatestamp = $buildcfg->{'earliestdatestamp'} || undef; 
    129132 
    130133    my $buildoutput = new IO::File(">$buildoutfile"); 
     
    184187    &output_metadata($buildwriter,'', 'numDocs', $numdocs); 
    185188    &output_metadata($buildwriter,'', 'buildType', $buildtype); 
     189    &output_metadata($buildwriter,'', 'indexStem', $indexstem) if(defined $indexstem); 
     190    &output_metadata($buildwriter,'', 'infodbType', $infodbtype); 
     191    &output_metadata($buildwriter,'', 'earliestDatestamp', $earliestDatestamp) if(defined $earliestDatestamp); 
    186192    $buildwriter->endTag('metadataList'); 
    187193     
     
    431437    if (defined $indexstem) { 
    432438    $buildwriter->emptyTag('indexStem', 'name'=>$indexstem); 
    433     }  
     439    } 
     440    $buildwriter->emptyTag('databaseType', 'name'=>$infodbtype) if (defined $infodbtype); 
     441     
    434442    # close off the Retrieve service 
    435443    $buildwriter->endTag('serviceRack'); 
     
    473481        if (defined $indexstem) { 
    474482            $buildwriter->emptyTag('indexStem', 'name'=>$indexstem); 
    475         }  
     483        } 
     484        $buildwriter->emptyTag('databaseType', 'name'=>$infodbtype) if (defined $infodbtype); 
    476485 
    477486        $buildwriter->startTag('classifierList');        
     
    490499            $content = @$cl[$i+1]; 
    491500            } 
    492              
     501 
     502            # remove "ex." prefix from "ex.metaname" but not from "ex.namespace.metaname" 
     503            $content =~ s@ex\.([^.]+)(,|;|$)@$1$2@g; #$content =~ s@ex\.([A-Z])@$1@g; 
    493504        } 
    494505        } 
     
    564575    $buildwriter->startTag('serviceRack', 'name'=>'GS2'.$service_type.'Search'); 
    565576    #$buildwriter->emptyTag('defaultIndex', 'shortname'=>$defaultindex); 
     577    $buildwriter->emptyTag('defaultIndex', 'shortname'=>$indexmap->{$defaultindex}); 
    566578    $buildwriter->startTag('indexList'); 
    567579    #for each index 
     
    573585    if (defined $indexstem) { 
    574586    $buildwriter->emptyTag('indexStem', 'name'=>$indexstem); 
    575     }  
     587    } 
     588    $buildwriter->emptyTag('databaseType', 'name'=>$infodbtype) if (defined $infodbtype); 
    576589     
    577590    # index options 
     
    597610    # level info 
    598611    $buildwriter->emptyTag('defaultLevel', 'shortname'=>$default_search_level_shortname); 
    599     $buildwriter->emptyTag('defaultGDBMLevel', 'shortname'=>$default_retrieve_level); 
     612    $buildwriter->emptyTag('defaultDBLevel', 'shortname'=>$default_retrieve_level); 
    600613    $buildwriter->startTag('levelList'); 
    601614    foreach my $l (@levellist) { 
     
    689702    $writer->startTag('metadata', 'name'=>$metaname); 
    690703    } 
    691     $writer->characters($metavalue); 
     704    $writer->characters($metavalue) if(defined $metavalue); 
    692705    $writer->endTag('metadata'); 
    693706}