Changeset 24464

Show
Ignore:
Timestamp:
24.08.2011 16:21:08 (8 years ago)
Author:
davidb
Message:

Support for orthogonal build types (such as audioDB)

Location:
main/trunk/greenstone2/perllib
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildConfigxml.pm

    r24070 r24464  
    4040# A mapping hash to resolve name discrepancy between gs2 and gs3. 
    4141my $nameMap = {"numDocs" => "numdocs", 
    42            "buildType" => "buildtype" 
     42           "buildType" => "buildtype", 
     43           "orthogonalBuildTypes" => "orthogonalbuildtypes" 
    4344           }; 
    4445 
     
    5051my $currentLocation = ""; 
    5152my $stringexp = q/^(buildType|numDocs)$/; 
    52    
     53my $arrayexp = q/^(orthogonalBuildTypes)$/; 
     54 
    5355my $indexmap_name = ""; 
    5456my $haveindexfields = 0; 
     
    9597     
    9698    #@ handling block metadataList 
    97     if (defined $name and $name =~ /$stringexp/){ 
     99    if (defined $name && (($name =~ m/$stringexp/) || ($name =~ m/$arrayexp/))) { 
    98100      $currentLocation = $name; 
    99101      # the value will be retrieved later in Text sub 
     
    112114    } 
    113115    else { 
     116        # mgpp or lucene 
    114117        $indexmap_name = "indexfieldmap"; 
    115118        $haveindexfields = 1; 
     
    145148    if (defined $currentLocation) {  
    146149    #@ Handling block metadataList(numDocs, buildType) 
    147     if($currentLocation =~ /$stringexp/){ 
     150    if ($currentLocation =~ /$stringexp/) { 
    148151        #print $currentLocation; 
    149152        my $key = $nameMap->{$currentLocation};  
     
    151154        undef $currentLocation; 
    152155    }    
     156    elsif ($currentLocation =~ /$arrayexp/) { 
     157        #print $currentLocation; 
     158        my $key = $nameMap->{$currentLocation};  
     159        push(@{$data->{$key}},$_); 
     160        undef $currentLocation; 
     161    }    
     162 
    153163    }    
    154164} 
     
    159169    print "NumDocs = ".$data->{'numdocs'}."\n" if (defined $data->{'numdocs'}); 
    160170    print "BuildType = ".$data->{'buildtype'}."\n" if (defined $data->{'buildtype'}); 
     171    print "OrthogonalBuildTypes = ".join(",",@{$data->{'orthogonalbuildtypes'}})."\n" if (defined $data->{'orthogonalbuildtypes'}); 
    161172    print  "IndexMap = ". join(" ",@{$data->{'indexmap'}})."\n" if (defined $data->{'indexmap'}); 
    162173    print  "IndexFieldMap = ". join(" ",@{$data->{'indexfieldmap'}})."\n" if (defined $data->{'indexfieldmap'}); 
     
    190201} 
    191202 
    192 # Create the buildConfig.xml file for a specific collection 
    193 sub write_cfg_file { 
    194     # this sub is called in make_auxiliary_files() in basebuilder.pm 
    195     # the received args: $buildoutfile - destination file: buildConfig.xml 
    196     #                    $buildcfg - all build options,  
    197     #                    $collectcfg - contents of collectionConfig.xml read in by read_cfg_file sub in buildConfigxml.pm. 
    198     my ($buildoutfile, $buildcfg, $collectcfg) = @_; 
    199     my $line = []; 
    200  
    201     if (!open (COLCFG, ">$buildoutfile")) { 
    202     print STDERR "buildConfigxml::write_cfg_file couldn't write the build config file $buildoutfile\n"; 
    203     die; 
    204     } 
    205  
    206     &write_line('COLCFG', ["<buildConfig xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">"]);   
    207  
    208     # output building metadata to build config file  
    209     my $buildtype; 
     203sub search_and_retrieve_settings 
     204{ 
     205    my ($buildcfg,$collectcfg) = @_; 
     206 
     207    my $settings = {}; 
     208 
    210209    if (defined $buildcfg->{"buildtype"}) { 
    211     $buildtype = $buildcfg->{"buildtype"}; 
     210    $settings->{'buildtype'} = $buildcfg->{"buildtype"}; 
    212211    } else { 
    213     $buildtype = "mgpp"; 
    214     } 
    215     my $numdocs; 
     212    $settings->{'buildtype'} = "mgpp"; 
     213    } 
     214    my $buildtype = $settings->{'buildtype'}; 
     215 
     216    if (defined $collectcfg->{"orthogonalbuildtypes"}) { 
     217    # Note the use of collectcfg, not bulidcfg 
     218    $settings->{'orthogonalbuildtypes'} = $collectcfg->{"orthogonalbuildtypes"}; 
     219    } else { 
     220    $settings->{'orthogonalbuildtypes '}= []; 
     221    } 
     222 
    216223    if (defined $buildcfg->{"numdocs"}) { 
    217       $numdocs = $buildcfg->{"numdocs"}; 
    218     } 
    219     &write_line('COLCFG', ["<metadataList>"]); 
    220     &write_line('COLCFG', ["<metadata name=\"numDocs\">", $numdocs, "</metadata>"]); 
    221     &write_line('COLCFG', ["<metadata name=\"buildType\">", $buildtype, "</metadata>"]); 
    222     if (defined $buildcfg->{'indexstem'}) { 
    223     &write_line('COLCFG', ["<metadata name=\"indexStem\">", $buildcfg->{"indexstem"}, "</metadata>"]); 
    224     } 
    225     if (defined $buildcfg->{'infodbtype'}) { 
    226     &write_line('COLCFG', ["<metadata name=\"infodbType\">", $buildcfg->{"infodbtype"}, "</metadata>"]); 
    227     } 
    228     if (defined $buildcfg->{'earliestdatestamp'}) { 
    229     &write_line('COLCFG', ["<metadata name=\"earliestdatestamp\">", $buildcfg->{"earliestdatestamp"}, "</metadata>"]); 
    230     } 
    231  
    232     &write_line('COLCFG', ["</metadataList>"]); 
     224    $settings->{'numdocs'} = $buildcfg->{"numdocs"}; 
     225    } 
     226    else { 
     227    $settings->{'numdocs'} = 0; 
     228    } 
    233229 
    234230    my $service_type = "MGPP"; 
     
    238234    $service_type = "Lucene"; 
    239235    } 
    240  
    241     # output serviceRackList 
    242     &write_line('COLCFG', ["<serviceRackList>"]); 
    243  
    244     # do the search service  
    245     &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]); 
    246     if (defined $buildcfg->{'indexstem'}) { 
    247       my $indexstem = $buildcfg->{'indexstem'}; 
    248       &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);      
    249     } 
    250     if (defined $buildcfg->{'infodbtype'}) { 
    251         my $infodbtype = $buildcfg->{'infodbtype'}; 
    252         &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);      
    253     } 
    254  
    255     #indexes 
    256     # maps index name to shortname 
    257     my $indexmap = {}; 
    258     # keeps the order for indexes 
    259     my @indexlist = (); 
    260      
     236    $settings->{'service_type'} = $service_type; 
     237 
     238 
     239    if (defined $buildcfg->{"infodbtype"}) { 
     240    $settings->{'infodbtype'} = $buildcfg->{'infodbtype'}; 
     241    } 
     242    else { 
     243    $settings->{'infodbtype'} = "gdbm"; 
     244    } 
     245 
     246 
     247    #-- 
     248    # indexes 
     249    #-- 
     250     
     251    my $indexmap = {};  # maps index name to shortname 
     252    my $indexlist = []; # keeps the order for indexes 
    261253    my $defaultindex = ""; 
    262     my $first = 1; 
    263     my $maptype = "indexfieldmap"; 
    264     if ($buildtype eq "mg") { 
    265     $maptype = "indexmap"; 
    266     } 
    267  
    268     #map {print $_."\n"} keys %$buildcfg; 
     254    my $maptype = ($buildtype eq "mg")  ? "indexmap" : "indexfieldmap"; 
    269255 
    270256    if (defined $buildcfg->{$maptype}) { 
     257    my $first = 1; 
    271258    my $indexmap_t = $buildcfg->{$maptype}; 
    272        foreach my $i (@$indexmap_t) { 
    273     my ($k, $v) = $i =~ /^(.*)\-\>(.*)$/; 
     259    foreach my $i (@$indexmap_t) { 
     260        my ($k, $v) = $i =~ /^(.*)\-\>(.*)$/; 
    274261        $indexmap->{$k} = $v; 
    275         push @indexlist, $k; 
     262        push @$indexlist, $k; 
    276263        if ($first) { 
    277264        $defaultindex = $v; 
    278265        $first = 0; 
    279         }    
    280     } 
    281     # now if the user has assigned a default index, we use it  
     266        } 
     267    } 
     268       # now if the user has assigned a default index, we use it 
    282269    if (defined $collectcfg->{"defaultindex"}) { 
    283       $defaultindex = $indexmap->{$collectcfg->{"defaultindex"}}; 
    284     } 
    285      
     270        $defaultindex = $indexmap->{$collectcfg->{"defaultindex"}}; 
     271    } 
    286272    } else { 
    287273    print STDERR "$maptype not defined"; 
    288     }   
    289     #for each index in indexList, write them out 
    290     &write_line('COLCFG', ["<indexList>"]); 
    291     foreach my $i (@indexlist) { 
    292     my $index = $indexmap->{$i}; 
    293     &write_line('COLCFG', ["<index name=\"", $i, "\" ", "shortname=\"", $index, "\" />"]); 
    294     }    
    295     &write_line('COLCFG', ["</indexList>"]); 
    296  
    297      
    298     #$defaultindex = "ZZ" if (!$defaultindex); # index allfields by default 
    299     if($defaultindex) { 
    300     &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]); 
    301     } 
    302  
    303  
    304     # do indexOptionList 
    305     if ($buildtype eq "mg" || $buildtype eq "mgpp") { 
    306         &write_line('COLCFG', ["<indexOptionList>"]); 
    307     my $stemindexes = 3; # default is stem and casefold 
    308     if (defined $buildcfg->{'stemindexes'} && $buildcfg->{'stemindexes'} =~ /^\d+$/ ) { 
    309         $stemindexes = $buildcfg->{'stemindexes'}; 
    310     } 
    311     &write_line('COLCFG', ["<indexOption name=\"stemIndexes\" value=\"", $stemindexes, "\" />"]); 
    312      
    313     my $maxnumeric = 4; # default 
    314     if (defined $buildcfg->{'maxnumeric'} && $buildcfg->{'maxnumeric'} =~ /^\d+$/) { 
    315         $maxnumeric = $buildcfg->{'maxnumeric'}; 
    316     } 
    317     &write_line('COLCFG', ["<indexOption name=\"maxnumeric\" value=\"", $maxnumeric, "\" />"]); 
    318         &write_line('COLCFG', ["</indexOptionList>"]); 
    319     } 
    320  
    321     #  levelList 
     274    } 
     275 
     276    $settings->{'defaultindex'} = $defaultindex; 
     277    $settings->{'indexmap'} = $indexmap; 
     278    $settings->{'indexlist'} = $indexlist; 
     279 
     280    #-- 
     281    # default lang 
     282    #-- 
     283    $settings->{'default_lang'} = ""; 
     284    $settings->{'default_lang_short'} = ""; 
     285 
     286    if (defined $buildcfg->{"languagemap"}) { 
     287      my $langmap_t = $buildcfg->{"languagemap"}; 
     288      if ((defined $langmap_t) && (scalar(@$langmap_t)>=1)) { 
     289      my $l = $langmap_t->[0]; 
     290      my ($k, $v) = $l =~ m/^(.*)\-\>(.*)$/;  
     291      $settings->{'default_lang'} = $k; #name 
     292      $settings->{'default_lang_short'} = $v; #short name 
     293      } 
     294 
     295      # now if the user has assigned a default language (as "en", "ru" etc.) 
     296      if (defined $collectcfg->{"defaultlanguage"}) { 
     297    $settings->{'default_lang'} = $collectcfg->{"defaultlanguage"}; 
     298    # what about default_lang_short ?? #### 
     299      } 
     300    } 
     301 
     302    # default subcol 
     303    $settings->{'default_subcol'} = ""; 
     304    if (defined $buildcfg->{'subcollectionmap'}) { 
     305    my $subcolmap_t = $buildcfg->{'subcollectionmap'}; 
     306    if ((defined $subcolmap_t) && (scalar(@$subcolmap_t)>=1)) { 
     307        my $l = $subcolmap_t->[0]; 
     308        my ($k, $v) = $l =~ m/^(.*)\-\>(.*)$/; 
     309 
     310        $settings->{'default_subcol'} = $v; 
     311    } 
     312    } 
     313 
     314 
     315    #-- 
     316    # indexstem 
     317    #-- 
     318    if (defined $buildcfg->{'indexstem'}) { 
     319    $settings->{'indexstem'} = $buildcfg->{'indexstem'}; 
     320    } 
     321 
     322    #-- 
     323    # levelList 
     324    #-- 
     325 
    322326    my $levelmap = {}; 
    323     my @levellist = (); 
     327    my $levellist = []; 
    324328    my $default_search_level = "Doc"; 
    325329    my $default_retrieve_level = "Doc"; 
    326330    my $default_db_level = "Doc"; 
    327     $first = 1; 
     331 
    328332    if ($buildtype eq "mgpp" || $buildtype eq "lucene") { 
    329333    if (defined $buildcfg->{'levelmap'}) { 
     334        my $first = 1; 
     335 
    330336        my $levelmap_t = $buildcfg->{'levelmap'}; 
    331337        foreach my $l (@$levelmap_t) { 
    332338        my ($key, $val) = $l =~ /^(.*)\-\>(.*)$/; 
    333339        $levelmap->{$key} = $val; 
    334         push @levellist, $key; 
     340        push @$levellist, $key; 
    335341        if ($first) { 
    336342            # let default search level follow the first level in the level list 
     
    356362    } 
    357363    } 
     364    $settings->{'levelmap'} = $levelmap; 
     365    $settings->{'levellist'} = $levellist; 
     366    $settings->{'default_search_level'} = $default_search_level; 
     367    $settings->{'default_retrieve_level'} = $default_retrieve_level; 
     368    $settings->{'default_db_level'} = $default_db_level; 
     369 
     370     
     371    return $settings; 
     372} 
     373 
     374 
     375sub write_search_servicerack 
     376{ 
     377    my ($buildcfg,$settings) = @_; 
     378 
     379    my $buildtype    = $settings->{'buildtype'}; 
     380    my $infodbtype   = $settings->{'infodbtype'}; 
     381    my $service_type = $settings->{'service_type'}; 
     382 
     383    # do the search service  
     384    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]); 
     385    if (defined $buildcfg->{'indexstem'}) { 
     386      my $indexstem = $buildcfg->{'indexstem'}; 
     387      &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);      
     388    } 
     389    if (defined $buildcfg->{'infodbtype'}) { 
     390        &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);      
     391    } 
     392 
     393    #indexes 
     394    my $indexmap = $settings->{'indexmap'}; 
     395    my $indexlist = $settings->{'indexlist'}; 
     396    my $defaultindex = $settings->{'defaultindex'}; 
     397 
     398    #for each index in indexList, write them out 
     399    &write_line('COLCFG', ["<indexList>"]); 
     400    foreach my $i (@$indexlist) { 
     401    my $index = $indexmap->{$i}; 
     402    &write_line('COLCFG', ["<index name=\"", $i, "\" ", "shortname=\"", $index, "\" />"]); 
     403    }    
     404    &write_line('COLCFG', ["</indexList>"]); 
     405 
     406     
     407    #$defaultindex = "ZZ" if (!$defaultindex); # index allfields by default 
     408    if ($defaultindex) { 
     409    &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]); 
     410    } 
     411 
     412 
     413    # do indexOptionList 
     414    if ($buildtype eq "mg" || $buildtype eq "mgpp") { 
     415        &write_line('COLCFG', ["<indexOptionList>"]); 
     416    my $stemindexes = 3; # default is stem and casefold 
     417    if (defined $buildcfg->{'stemindexes'} && $buildcfg->{'stemindexes'} =~ /^\d+$/ ) { 
     418        $stemindexes = $buildcfg->{'stemindexes'}; 
     419    } 
     420    &write_line('COLCFG', ["<indexOption name=\"stemIndexes\" value=\"", $stemindexes, "\" />"]); 
     421     
     422    my $maxnumeric = 4; # default 
     423    if (defined $buildcfg->{'maxnumeric'} && $buildcfg->{'maxnumeric'} =~ /^\d+$/) { 
     424        $maxnumeric = $buildcfg->{'maxnumeric'}; 
     425    } 
     426    &write_line('COLCFG', ["<indexOption name=\"maxnumeric\" value=\"", $maxnumeric, "\" />"]); 
     427        &write_line('COLCFG', ["</indexOptionList>"]); 
     428    } 
     429 
     430    #-- 
     431    # levelList 
     432    #-- 
     433    my $levelmap = $settings->{'levelmap'}; 
     434    my $levellist = $settings->{'levellist'}; 
     435    my $default_search_level = $settings->{'default_search_level'}; 
     436    my $default_retrieve_level = $settings->{'default_retrieve_level'}; 
     437    my $default_db_level = $settings->{'default_db_level'}; 
     438 
    358439    #for each level in levelList, write them out 
    359440    if ($buildtype ne "mg") { 
    360     &write_line('COLCFG', ["<levelList>"]); 
    361     foreach my $lv (@levellist) { 
    362     my $level = $levelmap->{$lv}; 
    363         &write_line('COLCFG', ["<level name=\"", $lv, "\" shortname=\"", $level, "\" />"]); 
    364     }    
    365     &write_line('COLCFG', ["</levelList>"]); 
     441    &write_line('COLCFG', ["<levelList>"]); 
     442    foreach my $lv (@$levellist) { 
     443        my $level = $levelmap->{$lv}; 
     444        &write_line('COLCFG', ["<level name=\"", $lv, "\" shortname=\"", $level, "\" />"]); 
     445    }    
     446    &write_line('COLCFG', ["</levelList>"]); 
    366447    } 
    367448    # add in defaultLevel as the same level as indexLevelList, making the reading job easier 
     
    389470 
    390471    # do indexLanguageList [in collect.cfg: languages; in build.cfg: languagemap] 
    391     $first = 1; 
    392     my $default_lang = ""; 
    393     my $default_lang_short = ""; 
     472    my $default_lang = $settings->{'default_lang'}; 
     473    my $default_lang_short = $settings->{'default_lang_short'}; 
    394474    if (defined $buildcfg->{"languagemap"}) { 
    395475      &write_line('COLCFG', ["<indexLanguageList>"]); 
     
    400480 
    401481    &write_line('COLCFG', ["<indexLanguage name=\"", $k, "\" shortname=\"", $v, "\" />"]); 
    402     if ($first) { 
    403       $default_lang = $k; #name 
    404       $default_lang_short = $v; #shortname 
    405       $first = 0; 
    406     } 
    407482      } 
    408483 
    409484      &write_line('COLCFG', ["</indexLanguageList>"]); 
    410       # now if the user has assigned a default language (as "en", "ru" etc.) 
    411       if (defined $collectcfg->{"defaultlanguage"}) { 
    412     $default_lang = $collectcfg->{"defaultlanguage"}; 
    413       } 
     485 
    414486      &write_line('COLCFG', ["<defaultIndexLanguage name=\"", $default_lang, "\" shortname=\"", $default_lang_short, "\" />"]); 
    415487    } 
    416488 
    417  
    418489    # do indexSubcollectionList 
    419     my $default_subcol = "";# make it in sub scope to be used in the concatenation 
     490    my $default_subcol = $settings->{'default_subcol'}; 
     491 
    420492    if (defined $buildcfg->{'subcollectionmap'}) { 
    421493      &write_line('COLCFG', ["<indexSubcollectionList>"]); 
    422494      my $subcolmap = {}; 
    423495      my @subcollist = (); 
    424       $first = 1; 
     496 
    425497      my $subcolmap_t = $buildcfg->{'subcollectionmap'}; 
    426498      foreach my $l (@$subcolmap_t) { 
     
    428500    $subcolmap->{$k} = $v; 
    429501    push @subcollist, $k; 
    430     if ($first) { 
    431       $default_subcol = $v; 
    432       $first = 0; 
    433     } 
    434502      } 
     503 
    435504      foreach my $sl (@subcollist) { 
    436505    my $subcol = $subcolmap->{$sl}; 
     
    445514    &write_line('COLCFG', ["</serviceRack>"]); 
    446515 
     516} 
     517 
     518 
     519sub write_orthogonalsearch_serviceracks 
     520{ 
     521    my ($buildcfg,$settings) = @_; 
     522 
     523    my $infodbtype   = $settings->{'infodbtype'}; 
     524 
     525    my $orthogonalbuildtypes = $settings->{'orthogonalbuildtypes'}; 
     526 
     527    foreach my $obt (@$orthogonalbuildtypes) { 
     528    $obt =~ s/^(.)/\u$1/; # capitialize initial letter 
     529    $obt =~ s/-(.)/\u$1/g; # change any hyphenated words to cap next letter 
     530 
     531    &write_line('COLCFG', ["<serviceRack name=\"GS2", $obt, "Search\">"]); 
     532 
     533    &write_line('COLCFG',["<databaseType name=\"",$infodbtype,"\" />"]);   
     534    &write_line('COLCFG', ["</serviceRack>"]); 
     535    } 
     536} 
     537 
     538 
     539 
     540sub write_retrieve_servicerack 
     541{ 
     542    my ($buildcfg,$settings) = @_; 
     543 
     544    my $buildtype      = $settings->{'buildtype'}; 
     545    my $infodbtype     = $settings->{'infodbtype'}; 
     546     
     547    my $service_type   = $settings->{'service_type'}; 
     548 
    447549    # do the retrieve service 
    448550    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Retrieve\">"]); 
     
    450552    # do default index  
    451553    if (defined $buildcfg->{"languagemap"}) { 
     554    my $default_lang   = $settings->{'default_lang'}; 
    452555    &write_line('COLCFG', ["<defaultIndexLanguage shortname=\"", $default_lang, "\" />"]); 
    453556    } 
    454557    if (defined $buildcfg->{'subcollectionmap'}) { 
     558    my $default_subcol = $settings->{'default_subcol'}; 
    455559    &write_line('COLCFG', ["<defaultIndexSubcollection shortname=\"", $default_subcol, "\" />"]); 
    456560    } 
    457561    if ($buildtype eq "mg") { 
     562    my $defaultindex   = $settings->{'defaultindex'}; 
    458563      &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]); 
    459564    } 
     
    464569    } 
    465570    if ($buildtype eq "mgpp" || $buildtype eq "lucene") { 
     571    my $default_retrieve_level = $settings->{'default_retrieve_level'}; 
    466572      &write_line('COLCFG', ["<defaultLevel shortname=\"", $default_retrieve_level, "\" />"]); 
    467573    } 
    468574    if (defined $buildcfg->{'infodbtype'}) { 
    469         my $infodbtype = $buildcfg->{'infodbtype'}; 
    470575        &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);      
    471576    } 
    472577 
    473578    &write_line('COLCFG', ["</serviceRack>"]); 
     579 
     580} 
     581 
     582 
     583# Create the buildConfig.xml file for a specific collection 
     584sub write_cfg_file { 
     585    # this sub is called in make_auxiliary_files() in basebuilder.pm 
     586    # the received args: $buildoutfile - destination file: buildConfig.xml 
     587    #                    $buildcfg - all build options,  
     588    #                    $collectcfg - contents of collectionConfig.xml read in by read_cfg_file sub in buildConfigxml.pm. 
     589    my ($buildoutfile, $buildcfg, $collectcfg) = @_; 
     590    my $line = []; 
     591 
     592    if (!open (COLCFG, ">$buildoutfile")) { 
     593    print STDERR "buildConfigxml::write_cfg_file couldn't write the build config file $buildoutfile\n"; 
     594    die; 
     595    } 
     596 
     597    my $settings = search_and_retrieve_settings($buildcfg,$collectcfg); 
     598 
     599    my $buildtype = $settings->{'buildtype'}; 
     600    my $orthogonalbuildtypes = $settings->{'orthogonalbuildtypes'}; 
     601    my $numdocs = $settings->{'numdocs'}; 
     602 
     603    &write_line('COLCFG', ["<buildConfig xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">"]);   
     604 
     605    # output building metadata to build config file  
     606    &write_line('COLCFG', ["<metadataList>"]); 
     607    &write_line('COLCFG', ["<metadata name=\"numDocs\">", $numdocs, "</metadata>"]); 
     608    &write_line('COLCFG', ["<metadata name=\"buildType\">", $buildtype, "</metadata>"]); 
     609    foreach my $obt (@$orthogonalbuildtypes) { 
     610    &write_line('COLCFG', ["<metadata name=\"orthogonalBuildTypes\">", $obt, "</metadata>"]); 
     611    } 
     612 
     613    if (defined $buildcfg->{'indexstem'}) { 
     614    &write_line('COLCFG', ["<metadata name=\"indexStem\">", $buildcfg->{"indexstem"}, "</metadata>"]); 
     615    } 
     616    if (defined $buildcfg->{'infodbtype'}) { 
     617    &write_line('COLCFG', ["<metadata name=\"infodbType\">", $buildcfg->{"infodbtype"}, "</metadata>"]); 
     618    } 
     619    if (defined $buildcfg->{'earliestdatestamp'}) { 
     620    &write_line('COLCFG', ["<metadata name=\"earliestdatestamp\">", $buildcfg->{"earliestdatestamp"}, "</metadata>"]); 
     621    } 
     622 
     623    &write_line('COLCFG', ["</metadataList>"]); 
     624 
     625    # output serviceRackList 
     626    &write_line('COLCFG', ["<serviceRackList>"]); 
     627 
     628    write_search_servicerack($buildcfg,$settings); 
     629 
     630    # add in orthogonalbuildtypes 
     631    write_orthogonalsearch_serviceracks($buildcfg,$settings); 
     632 
     633    write_retrieve_servicerack($buildcfg,$settings); 
    474634 
    475635    # do the browse service 
  • main/trunk/greenstone2/perllib/colcfg.pm

    r23939 r24464  
    4646# {'textcompress'}->string 
    4747# {'buildtype'}->string 
     48# {'orthogonalbuildtypes'}->array of strings 
    4849# {'maxnumeric'}->string 
    4950# {'separate_cjk'}->string 
     
    114115# {'builddate'}->string 
    115116# {'buildtype'}->string 
     117# {'orthogonalbuildtypes'}->array of strings 
    116118# {'metadata'}->array of strings 
    117119# {'languages'}->array of strings 
     
    167169                    q/^(infodbtype|creator|public|defaultindex|importdir|/ . 
    168170                    q/archivedir|cachedir|builddir|removeold|/ . 
    169                     q/textcompress|buildtype|no_text|keepold|gzip|/ . 
     171                    q/textcompress|buildtype|othogonalbuildtypes|no_text|keepold|gzip|/ . 
    170172                    q/verbosity|remove_empty_classifications|OIDtype|OIDmetadata|/ . 
    171173                    q/groupsize|maxdocs|debug|mode|saveas|/ . 
     
    174176                    q/no_strip_html|index|sections_index_document_metadata|/ . 
    175177                    q/store_metadata_coverage)$/, 
    176                     q/(maintainer|languages|indexsubcollections|/ . 
     178                    q/(maintainer|languages|indexsubcollections|orthogonalbuildtypes/ . 
    177179                       q/indexes|indexoptions|dontbuild|dontgdbm|mirror|levels|plugout|/ . 
    178180                       q/searchtype|searchtypes)$/, 
     
    195197                 q/maxnumeric|languagemetadata/ . 
    196198                 q/no_strip_html|index|sections_index_document_metadata)$/, 
    197                  q/^(maintainer|languages|indexsubcollections|/ . 
     199                 q/^(maintainer|languages|indexsubcollections|orthogonalbuildtypes/ . 
    198200                 q/indexes|indexoptions|dontbuild|dontgdbm|mirror|levels|/. 
    199201                 q/searchtype|searchtypes)$/, 
     
    226228    return &cfgread::read_cfg_file ($filename,  
    227229           q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/, 
    228            q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/); 
     230           q/^(indexmap|subcollectionmap|languagemap|orthogonalbuildtypes|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/); 
    229231                     
    230232} 
     
    236238    &cfgread::write_cfg_file($filename, $data, 
    237239           q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/, 
    238            q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);             
     240           q/^(indexmap|subcollectionmap|languagemap|orthogonalbuildtypes|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);            
    239241} 
    240242 
  • main/trunk/greenstone2/perllib/collConfigxml.pm

    r24055 r24464  
    5757           "languageMetadata" => "languagemetadata", 
    5858           "buildType" => "buildtype", 
    59            "buildOption" => "buildOption" 
     59           "orthogonalBuildTypes" => "orthogonalbuildtypes", 
     60           "buildOption" => "buildOption" 
    6061           }; 
    6162# A hash structure which is returned by sub read_cfg_file. 
     
    7980# ("plugin", "option") 
    8081my $currentIndex = 0; 
    81 my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage)$/; 
     82my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/; 
    8283my $arrayarrayexp= q/^(plugin|classifier)$/; #|buildOption)$/; 
    8384my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here 
     
    129130    my $value = $_{'value'}; 
    130131    my $type = $_{'type'}; 
     132    my $orthogonal = $_{'orthogonal'}; 
    131133 
    132134    # for subcollections 
     
    169171     
    170172    #@ Handling indexer: mgpp/mg/lucene; stringexp 
     173    #@ Handling orthogonal indexers: audioDB; arrayexp 
    171174    elsif ($element eq "search") { 
    172       $data->{'buildtype'} = $type; 
     175    if ((defined $orthogonal) && ($orthogonal =~ m/^(true|on|1)$/i)) { 
     176        push(@{$data->{'orthogonalbuildtypes'}},$type); 
     177    } 
     178    else { 
     179        $data->{'buildtype'} = $type; 
     180    } 
    173181    } 
    174182     
    175     elsif ($element eq "store_metadata_coverage") 
    176     { 
    177         print STDERR "*&*&*&*&*& HERE &*&*&*&*&*&*"; 
    178       $data->{'store_metadata_coverage'} = $value; 
    179     } 
     183    elsif ($element eq "store_metadata_coverage") 
     184    { 
     185##  print STDERR "*&*&*&*&*& HERE &*&*&*&*&*&*"; 
     186    $data->{'store_metadata_coverage'} = $value; 
     187    } 
    180188 
    181189    #@ Handling searchtype: plain,form; arrayexp 
     
    363371    print STDERR "*** default level: ".$data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"}); 
    364372    print STDERR "*** build type: ".$data->{"buildtype"}."\n" if (defined $data->{"buildtype"}); 
     373    print STDERR "*** orthogonal build types: ".join(",",$data->{"orthogonalbuildtypes"})."\n" if (defined $data->{"orthogonalbuildtypes"}); 
    365374    print STDERR "*** search types: \n"; 
    366375    print STDERR join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});