Index: /main/trunk/greenstone2/perllib/buildConfigxml.pm
===================================================================
--- /main/trunk/greenstone2/perllib/buildConfigxml.pm	(revision 24463)
+++ /main/trunk/greenstone2/perllib/buildConfigxml.pm	(revision 24464)
@@ -40,5 +40,6 @@
 # A mapping hash to resolve name discrepancy between gs2 and gs3.
 my $nameMap = {"numDocs" => "numdocs",
-	       "buildType" => "buildtype"
+	       "buildType" => "buildtype",
+	       "orthogonalBuildTypes" => "orthogonalbuildtypes"
 	       };
 
@@ -50,5 +51,6 @@
 my $currentLocation = "";
 my $stringexp = q/^(buildType|numDocs)$/;
-  
+my $arrayexp = q/^(orthogonalBuildTypes)$/;
+
 my $indexmap_name = "";
 my $haveindexfields = 0;
@@ -95,5 +97,5 @@
     
     #@ handling block metadataList
-    if (defined $name and $name =~ /$stringexp/){
+    if (defined $name && (($name =~ m/$stringexp/) || ($name =~ m/$arrayexp/))) {
       $currentLocation = $name;
       # the value will be retrieved later in Text sub
@@ -112,4 +114,5 @@
 	}
 	else {
+	    # mgpp or lucene
 	    $indexmap_name = "indexfieldmap";
 	    $haveindexfields = 1;
@@ -145,5 +148,5 @@
     if (defined $currentLocation) { 
 	#@ Handling block metadataList(numDocs, buildType)
-	if($currentLocation =~ /$stringexp/){
+	if ($currentLocation =~ /$stringexp/) {
 	    #print $currentLocation;
 	    my $key = $nameMap->{$currentLocation};	
@@ -151,4 +154,11 @@
 	    undef $currentLocation;
 	}	
+	elsif ($currentLocation =~ /$arrayexp/) {
+	    #print $currentLocation;
+	    my $key = $nameMap->{$currentLocation};	
+	    push(@{$data->{$key}},$_);
+	    undef $currentLocation;
+	}	
+
     }	
 }
@@ -159,4 +169,5 @@
     print "NumDocs = ".$data->{'numdocs'}."\n" if (defined $data->{'numdocs'});
     print "BuildType = ".$data->{'buildtype'}."\n" if (defined $data->{'buildtype'});
+    print "OrthogonalBuildTypes = ".join(",",@{$data->{'orthogonalbuildtypes'}})."\n" if (defined $data->{'orthogonalbuildtypes'});
     print  "IndexMap = ". join(" ",@{$data->{'indexmap'}})."\n" if (defined $data->{'indexmap'});
     print  "IndexFieldMap = ". join(" ",@{$data->{'indexfieldmap'}})."\n" if (defined $data->{'indexfieldmap'});
@@ -190,45 +201,30 @@
 }
 
-# Create the buildConfig.xml file for a specific collection
-sub write_cfg_file {
-    # this sub is called in make_auxiliary_files() in basebuilder.pm
-    # the received args: $buildoutfile - destination file: buildConfig.xml
-    #                    $buildcfg - all build options, 
-    #                    $collectcfg - contents of collectionConfig.xml read in by read_cfg_file sub in buildConfigxml.pm.
-    my ($buildoutfile, $buildcfg, $collectcfg) = @_;
-    my $line = [];
-
-    if (!open (COLCFG, ">$buildoutfile")) {
-	print STDERR "buildConfigxml::write_cfg_file couldn't write the build config file $buildoutfile\n";
-	die;
-    }
-
-    &write_line('COLCFG', ["<buildConfig xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">"]);  
-
-    # output building metadata to build config file 
-    my $buildtype;
+sub search_and_retrieve_settings
+{
+    my ($buildcfg,$collectcfg) = @_;
+
+    my $settings = {};
+
     if (defined $buildcfg->{"buildtype"}) {
-	$buildtype = $buildcfg->{"buildtype"};
+	$settings->{'buildtype'} = $buildcfg->{"buildtype"};
     } else {
-	$buildtype = "mgpp";
-    }
-    my $numdocs;
+	$settings->{'buildtype'} = "mgpp";
+    }
+    my $buildtype = $settings->{'buildtype'};
+
+    if (defined $collectcfg->{"orthogonalbuildtypes"}) {
+	# Note the use of collectcfg, not bulidcfg
+	$settings->{'orthogonalbuildtypes'} = $collectcfg->{"orthogonalbuildtypes"};
+    } else {
+	$settings->{'orthogonalbuildtypes '}= [];
+    }
+
     if (defined $buildcfg->{"numdocs"}) {
-      $numdocs = $buildcfg->{"numdocs"};
-    }
-    &write_line('COLCFG', ["<metadataList>"]);
-    &write_line('COLCFG', ["<metadata name=\"numDocs\">", $numdocs, "</metadata>"]);
-    &write_line('COLCFG', ["<metadata name=\"buildType\">", $buildtype, "</metadata>"]);
-    if (defined $buildcfg->{'indexstem'}) {
-	&write_line('COLCFG', ["<metadata name=\"indexStem\">", $buildcfg->{"indexstem"}, "</metadata>"]);
-    }
-    if (defined $buildcfg->{'infodbtype'}) {
-	&write_line('COLCFG', ["<metadata name=\"infodbType\">", $buildcfg->{"infodbtype"}, "</metadata>"]);
-    }
-    if (defined $buildcfg->{'earliestdatestamp'}) {
-	&write_line('COLCFG', ["<metadata name=\"earliestdatestamp\">", $buildcfg->{"earliestdatestamp"}, "</metadata>"]);
-    }
-
-    &write_line('COLCFG', ["</metadataList>"]);
+	$settings->{'numdocs'} = $buildcfg->{"numdocs"};
+    }
+    else {
+	$settings->{'numdocs'} = 0;
+    }
 
     my $service_type = "MGPP";
@@ -238,99 +234,109 @@
 	$service_type = "Lucene";
     }
-
-    # output serviceRackList
-    &write_line('COLCFG', ["<serviceRackList>"]);
-
-    # do the search service 
-    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]);
-    if (defined $buildcfg->{'indexstem'}) {
-      my $indexstem = $buildcfg->{'indexstem'};
-      &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);     
-    }
-    if (defined $buildcfg->{'infodbtype'}) {
-        my $infodbtype = $buildcfg->{'infodbtype'};
-        &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);     
-    }
-
-    #indexes
-    # maps index name to shortname
-    my $indexmap = {};
-    # keeps the order for indexes
-    my @indexlist = ();
-    
+    $settings->{'service_type'} = $service_type;
+
+
+    if (defined $buildcfg->{"infodbtype"}) {
+	$settings->{'infodbtype'} = $buildcfg->{'infodbtype'};
+    }
+    else {
+	$settings->{'infodbtype'} = "gdbm";
+    }
+
+
+    #--
+    # indexes
+    #--
+    
+    my $indexmap = {};  # maps index name to shortname
+    my $indexlist = []; # keeps the order for indexes
     my $defaultindex = "";
-    my $first = 1;
-    my $maptype = "indexfieldmap";
-    if ($buildtype eq "mg") {
-	$maptype = "indexmap";
-    }
-
-    #map {print $_."\n"} keys %$buildcfg;
+    my $maptype = ($buildtype eq "mg")  ? "indexmap" : "indexfieldmap";
 
     if (defined $buildcfg->{$maptype}) {
+	my $first = 1;
 	my $indexmap_t = $buildcfg->{$maptype};
-       foreach my $i (@$indexmap_t) {
-    my ($k, $v) = $i =~ /^(.*)\-\>(.*)$/;
+	foreach my $i (@$indexmap_t) {
+	    my ($k, $v) = $i =~ /^(.*)\-\>(.*)$/;
 	    $indexmap->{$k} = $v;
-	    push @indexlist, $k;
+	    push @$indexlist, $k;
 	    if ($first) {
 		$defaultindex = $v;
 		$first = 0;
-	    }	
-	}
-	# now if the user has assigned a default index, we use it 
+	    }
+	}
+       # now if the user has assigned a default index, we use it
 	if (defined $collectcfg->{"defaultindex"}) {
-	  $defaultindex = $indexmap->{$collectcfg->{"defaultindex"}};
-	}
-	
+	    $defaultindex = $indexmap->{$collectcfg->{"defaultindex"}};
+	}
     } else {
 	print STDERR "$maptype not defined";
-    }  
-    #for each index in indexList, write them out
-    &write_line('COLCFG', ["<indexList>"]);
-    foreach my $i (@indexlist) {
-	my $index = $indexmap->{$i};
-	&write_line('COLCFG', ["<index name=\"", $i, "\" ", "shortname=\"", $index, "\" />"]);
-    }	
-    &write_line('COLCFG', ["</indexList>"]);
-
-    
-    #$defaultindex = "ZZ" if (!$defaultindex); # index allfields by default
-    if($defaultindex) {
-	&write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]);
-    }
-
-
-    # do indexOptionList
-    if ($buildtype eq "mg" || $buildtype eq "mgpp") {
-        &write_line('COLCFG', ["<indexOptionList>"]);
-	my $stemindexes = 3; # default is stem and casefold
-	if (defined $buildcfg->{'stemindexes'} && $buildcfg->{'stemindexes'} =~ /^\d+$/ ) {
-	    $stemindexes = $buildcfg->{'stemindexes'};
-	}
-	&write_line('COLCFG', ["<indexOption name=\"stemIndexes\" value=\"", $stemindexes, "\" />"]);
-	
-	my $maxnumeric = 4; # default
-	if (defined $buildcfg->{'maxnumeric'} && $buildcfg->{'maxnumeric'} =~ /^\d+$/) {
-	    $maxnumeric = $buildcfg->{'maxnumeric'};
-	}
-	&write_line('COLCFG', ["<indexOption name=\"maxnumeric\" value=\"", $maxnumeric, "\" />"]);
-        &write_line('COLCFG', ["</indexOptionList>"]);
-    }
-
-    #  levelList
+    }
+
+    $settings->{'defaultindex'} = $defaultindex;
+    $settings->{'indexmap'} = $indexmap;
+    $settings->{'indexlist'} = $indexlist;
+
+    #--
+    # default lang
+    #--
+    $settings->{'default_lang'} = "";
+    $settings->{'default_lang_short'} = "";
+
+    if (defined $buildcfg->{"languagemap"}) {
+      my $langmap_t = $buildcfg->{"languagemap"};
+      if ((defined $langmap_t) && (scalar(@$langmap_t)>=1)) {
+	  my $l = $langmap_t->[0];
+	  my ($k, $v) = $l =~ m/^(.*)\-\>(.*)$/; 
+	  $settings->{'default_lang'} = $k; #name
+	  $settings->{'default_lang_short'} = $v; #short name
+      }
+
+      # now if the user has assigned a default language (as "en", "ru" etc.)
+      if (defined $collectcfg->{"defaultlanguage"}) {
+	$settings->{'default_lang'} = $collectcfg->{"defaultlanguage"};
+	# what about default_lang_short ?? ####
+      }
+    }
+
+    # default subcol
+    $settings->{'default_subcol'} = "";
+    if (defined $buildcfg->{'subcollectionmap'}) {
+	my $subcolmap_t = $buildcfg->{'subcollectionmap'};
+	if ((defined $subcolmap_t) && (scalar(@$subcolmap_t)>=1)) {
+	    my $l = $subcolmap_t->[0];
+	    my ($k, $v) = $l =~ m/^(.*)\-\>(.*)$/;
+
+	    $settings->{'default_subcol'} = $v;
+	}
+    }
+
+
+    #--
+    # indexstem
+    #--
+    if (defined $buildcfg->{'indexstem'}) {
+	$settings->{'indexstem'} = $buildcfg->{'indexstem'};
+    }
+
+    #--
+    # levelList
+    #--
+
     my $levelmap = {};
-    my @levellist = ();
+    my $levellist = [];
     my $default_search_level = "Doc";
     my $default_retrieve_level = "Doc";
     my $default_db_level = "Doc";
-    $first = 1;
+
     if ($buildtype eq "mgpp" || $buildtype eq "lucene") {
 	if (defined $buildcfg->{'levelmap'}) {
+	    my $first = 1;
+
 	    my $levelmap_t = $buildcfg->{'levelmap'};
 	    foreach my $l (@$levelmap_t) {
 		my ($key, $val) = $l =~ /^(.*)\-\>(.*)$/;
 		$levelmap->{$key} = $val;
-		push @levellist, $key;
+		push @$levellist, $key;
 		if ($first) {
 		    # let default search level follow the first level in the level list
@@ -356,12 +362,87 @@
 	}
     }
+    $settings->{'levelmap'} = $levelmap;
+    $settings->{'levellist'} = $levellist;
+    $settings->{'default_search_level'} = $default_search_level;
+    $settings->{'default_retrieve_level'} = $default_retrieve_level;
+    $settings->{'default_db_level'} = $default_db_level;
+
+    
+    return $settings;
+}
+
+
+sub write_search_servicerack
+{
+    my ($buildcfg,$settings) = @_;
+
+    my $buildtype    = $settings->{'buildtype'};
+    my $infodbtype   = $settings->{'infodbtype'};
+    my $service_type = $settings->{'service_type'};
+
+    # do the search service 
+    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]);
+    if (defined $buildcfg->{'indexstem'}) {
+      my $indexstem = $buildcfg->{'indexstem'};
+      &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);     
+    }
+    if (defined $buildcfg->{'infodbtype'}) {
+        &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);     
+    }
+
+    #indexes
+    my $indexmap = $settings->{'indexmap'};
+    my $indexlist = $settings->{'indexlist'};
+    my $defaultindex = $settings->{'defaultindex'};
+
+    #for each index in indexList, write them out
+    &write_line('COLCFG', ["<indexList>"]);
+    foreach my $i (@$indexlist) {
+	my $index = $indexmap->{$i};
+	&write_line('COLCFG', ["<index name=\"", $i, "\" ", "shortname=\"", $index, "\" />"]);
+    }	
+    &write_line('COLCFG', ["</indexList>"]);
+
+    
+    #$defaultindex = "ZZ" if (!$defaultindex); # index allfields by default
+    if ($defaultindex) {
+	&write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]);
+    }
+
+
+    # do indexOptionList
+    if ($buildtype eq "mg" || $buildtype eq "mgpp") {
+        &write_line('COLCFG', ["<indexOptionList>"]);
+	my $stemindexes = 3; # default is stem and casefold
+	if (defined $buildcfg->{'stemindexes'} && $buildcfg->{'stemindexes'} =~ /^\d+$/ ) {
+	    $stemindexes = $buildcfg->{'stemindexes'};
+	}
+	&write_line('COLCFG', ["<indexOption name=\"stemIndexes\" value=\"", $stemindexes, "\" />"]);
+	
+	my $maxnumeric = 4; # default
+	if (defined $buildcfg->{'maxnumeric'} && $buildcfg->{'maxnumeric'} =~ /^\d+$/) {
+	    $maxnumeric = $buildcfg->{'maxnumeric'};
+	}
+	&write_line('COLCFG', ["<indexOption name=\"maxnumeric\" value=\"", $maxnumeric, "\" />"]);
+        &write_line('COLCFG', ["</indexOptionList>"]);
+    }
+
+    #--
+    # levelList
+    #--
+    my $levelmap = $settings->{'levelmap'};
+    my $levellist = $settings->{'levellist'};
+    my $default_search_level = $settings->{'default_search_level'};
+    my $default_retrieve_level = $settings->{'default_retrieve_level'};
+    my $default_db_level = $settings->{'default_db_level'};
+
     #for each level in levelList, write them out
     if ($buildtype ne "mg") {
-    &write_line('COLCFG', ["<levelList>"]);
-    foreach my $lv (@levellist) {
-	my $level = $levelmap->{$lv};
-        &write_line('COLCFG', ["<level name=\"", $lv, "\" shortname=\"", $level, "\" />"]);
-    }	
-    &write_line('COLCFG', ["</levelList>"]);
+	&write_line('COLCFG', ["<levelList>"]);
+	foreach my $lv (@$levellist) {
+	    my $level = $levelmap->{$lv};
+	    &write_line('COLCFG', ["<level name=\"", $lv, "\" shortname=\"", $level, "\" />"]);
+	}	
+	&write_line('COLCFG', ["</levelList>"]);
     }
     # add in defaultLevel as the same level as indexLevelList, making the reading job easier
@@ -389,7 +470,6 @@
 
     # do indexLanguageList [in collect.cfg: languages; in build.cfg: languagemap]
-    $first = 1;
-    my $default_lang = "";
-    my $default_lang_short = "";
+    my $default_lang = $settings->{'default_lang'};
+    my $default_lang_short = $settings->{'default_lang_short'};
     if (defined $buildcfg->{"languagemap"}) {
       &write_line('COLCFG', ["<indexLanguageList>"]);
@@ -400,27 +480,19 @@
 
 	&write_line('COLCFG', ["<indexLanguage name=\"", $k, "\" shortname=\"", $v, "\" />"]);
-	if ($first) {
-	  $default_lang = $k; #name
-	  $default_lang_short = $v; #shortname
-	  $first = 0;
-	}
       }
 
       &write_line('COLCFG', ["</indexLanguageList>"]);
-      # now if the user has assigned a default language (as "en", "ru" etc.)
-      if (defined $collectcfg->{"defaultlanguage"}) {
-	$default_lang = $collectcfg->{"defaultlanguage"};
-      }
+
       &write_line('COLCFG', ["<defaultIndexLanguage name=\"", $default_lang, "\" shortname=\"", $default_lang_short, "\" />"]);
     }
 
-
     # do indexSubcollectionList
-    my $default_subcol = "";# make it in sub scope to be used in the concatenation
+    my $default_subcol = $settings->{'default_subcol'};
+
     if (defined $buildcfg->{'subcollectionmap'}) {
       &write_line('COLCFG', ["<indexSubcollectionList>"]);
       my $subcolmap = {};
       my @subcollist = ();
-      $first = 1;
+
       my $subcolmap_t = $buildcfg->{'subcollectionmap'};
       foreach my $l (@$subcolmap_t) {
@@ -428,9 +500,6 @@
 	$subcolmap->{$k} = $v;
 	push @subcollist, $k;
-	if ($first) {
-	  $default_subcol = $v;
-	  $first = 0;
-	}
       }
+
       foreach my $sl (@subcollist) {
 	my $subcol = $subcolmap->{$sl};
@@ -445,4 +514,37 @@
     &write_line('COLCFG', ["</serviceRack>"]);
 
+}
+
+
+sub write_orthogonalsearch_serviceracks
+{
+    my ($buildcfg,$settings) = @_;
+
+    my $infodbtype   = $settings->{'infodbtype'};
+
+    my $orthogonalbuildtypes = $settings->{'orthogonalbuildtypes'};
+
+    foreach my $obt (@$orthogonalbuildtypes) {
+	$obt =~ s/^(.)/\u$1/; # capitialize initial letter
+	$obt =~ s/-(.)/\u$1/g; # change any hyphenated words to cap next letter
+
+	&write_line('COLCFG', ["<serviceRack name=\"GS2", $obt, "Search\">"]);
+
+	&write_line('COLCFG',["<databaseType name=\"",$infodbtype,"\" />"]);  
+	&write_line('COLCFG', ["</serviceRack>"]);
+    }
+}
+
+
+
+sub write_retrieve_servicerack
+{
+    my ($buildcfg,$settings) = @_;
+
+    my $buildtype      = $settings->{'buildtype'};
+    my $infodbtype     = $settings->{'infodbtype'};
+    
+    my $service_type   = $settings->{'service_type'};
+
     # do the retrieve service
     &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Retrieve\">"]);
@@ -450,10 +552,13 @@
     # do default index 
     if (defined $buildcfg->{"languagemap"}) {
+	my $default_lang   = $settings->{'default_lang'};
 	&write_line('COLCFG', ["<defaultIndexLanguage shortname=\"", $default_lang, "\" />"]);
     }
     if (defined $buildcfg->{'subcollectionmap'}) {
+	my $default_subcol = $settings->{'default_subcol'};
 	&write_line('COLCFG', ["<defaultIndexSubcollection shortname=\"", $default_subcol, "\" />"]);
     }
     if ($buildtype eq "mg") {
+	my $defaultindex   = $settings->{'defaultindex'};
       &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]);
     }
@@ -464,12 +569,67 @@
     }
     if ($buildtype eq "mgpp" || $buildtype eq "lucene") {
+	my $default_retrieve_level = $settings->{'default_retrieve_level'};
       &write_line('COLCFG', ["<defaultLevel shortname=\"", $default_retrieve_level, "\" />"]);
     }
     if (defined $buildcfg->{'infodbtype'}) {
-        my $infodbtype = $buildcfg->{'infodbtype'};
         &write_line('COLCFG', ["<databaseType name=\"", $infodbtype, "\" />"]);     
     }
 
     &write_line('COLCFG', ["</serviceRack>"]);
+
+}
+
+
+# Create the buildConfig.xml file for a specific collection
+sub write_cfg_file {
+    # this sub is called in make_auxiliary_files() in basebuilder.pm
+    # the received args: $buildoutfile - destination file: buildConfig.xml
+    #                    $buildcfg - all build options, 
+    #                    $collectcfg - contents of collectionConfig.xml read in by read_cfg_file sub in buildConfigxml.pm.
+    my ($buildoutfile, $buildcfg, $collectcfg) = @_;
+    my $line = [];
+
+    if (!open (COLCFG, ">$buildoutfile")) {
+	print STDERR "buildConfigxml::write_cfg_file couldn't write the build config file $buildoutfile\n";
+	die;
+    }
+
+    my $settings = search_and_retrieve_settings($buildcfg,$collectcfg);
+
+    my $buildtype = $settings->{'buildtype'};
+    my $orthogonalbuildtypes = $settings->{'orthogonalbuildtypes'};
+    my $numdocs = $settings->{'numdocs'};
+
+    &write_line('COLCFG', ["<buildConfig xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">"]);  
+
+    # output building metadata to build config file 
+    &write_line('COLCFG', ["<metadataList>"]);
+    &write_line('COLCFG', ["<metadata name=\"numDocs\">", $numdocs, "</metadata>"]);
+    &write_line('COLCFG', ["<metadata name=\"buildType\">", $buildtype, "</metadata>"]);
+    foreach my $obt (@$orthogonalbuildtypes) {
+	&write_line('COLCFG', ["<metadata name=\"orthogonalBuildTypes\">", $obt, "</metadata>"]);
+    }
+
+    if (defined $buildcfg->{'indexstem'}) {
+	&write_line('COLCFG', ["<metadata name=\"indexStem\">", $buildcfg->{"indexstem"}, "</metadata>"]);
+    }
+    if (defined $buildcfg->{'infodbtype'}) {
+	&write_line('COLCFG', ["<metadata name=\"infodbType\">", $buildcfg->{"infodbtype"}, "</metadata>"]);
+    }
+    if (defined $buildcfg->{'earliestdatestamp'}) {
+	&write_line('COLCFG', ["<metadata name=\"earliestdatestamp\">", $buildcfg->{"earliestdatestamp"}, "</metadata>"]);
+    }
+
+    &write_line('COLCFG', ["</metadataList>"]);
+
+    # output serviceRackList
+    &write_line('COLCFG', ["<serviceRackList>"]);
+
+    write_search_servicerack($buildcfg,$settings);
+
+    # add in orthogonalbuildtypes
+    write_orthogonalsearch_serviceracks($buildcfg,$settings);
+
+    write_retrieve_servicerack($buildcfg,$settings);
 
     # do the browse service
Index: /main/trunk/greenstone2/perllib/colcfg.pm
===================================================================
--- /main/trunk/greenstone2/perllib/colcfg.pm	(revision 24463)
+++ /main/trunk/greenstone2/perllib/colcfg.pm	(revision 24464)
@@ -46,4 +46,5 @@
 # {'textcompress'}->string
 # {'buildtype'}->string
+# {'orthogonalbuildtypes'}->array of strings
 # {'maxnumeric'}->string
 # {'separate_cjk'}->string
@@ -114,4 +115,5 @@
 # {'builddate'}->string
 # {'buildtype'}->string
+# {'orthogonalbuildtypes'}->array of strings
 # {'metadata'}->array of strings
 # {'languages'}->array of strings
@@ -167,5 +169,5 @@
 				    q/^(infodbtype|creator|public|defaultindex|importdir|/ .
 					q/archivedir|cachedir|builddir|removeold|/ .
-					q/textcompress|buildtype|no_text|keepold|gzip|/ .
+					q/textcompress|buildtype|othogonalbuildtypes|no_text|keepold|gzip|/ .
 					q/verbosity|remove_empty_classifications|OIDtype|OIDmetadata|/ .
 					q/groupsize|maxdocs|debug|mode|saveas|/ .
@@ -174,5 +176,5 @@
 					q/no_strip_html|index|sections_index_document_metadata|/ .
 					q/store_metadata_coverage)$/,
-				    q/(maintainer|languages|indexsubcollections|/ .
+				    q/(maintainer|languages|indexsubcollections|orthogonalbuildtypes/ .
 				       q/indexes|indexoptions|dontbuild|dontgdbm|mirror|levels|plugout|/ .
 				       q/searchtype|searchtypes)$/,
@@ -195,5 +197,5 @@
 				 q/maxnumeric|languagemetadata/ .
 				 q/no_strip_html|index|sections_index_document_metadata)$/,
-			     q/^(maintainer|languages|indexsubcollections|/ .
+			     q/^(maintainer|languages|indexsubcollections|orthogonalbuildtypes/ .
 				 q/indexes|indexoptions|dontbuild|dontgdbm|mirror|levels|/.
 				 q/searchtype|searchtypes)$/,
@@ -226,5 +228,5 @@
     return &cfgread::read_cfg_file ($filename, 
 		   q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/,
-		   q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);
+		   q/^(indexmap|subcollectionmap|languagemap|orthogonalbuildtypes|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);
 				    
 }
@@ -236,5 +238,5 @@
     &cfgread::write_cfg_file($filename, $data,
 	       q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/,
-	       q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);		     
+	       q/^(indexmap|subcollectionmap|languagemap|orthogonalbuildtypes|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/);		     
 }
 
Index: /main/trunk/greenstone2/perllib/collConfigxml.pm
===================================================================
--- /main/trunk/greenstone2/perllib/collConfigxml.pm	(revision 24463)
+++ /main/trunk/greenstone2/perllib/collConfigxml.pm	(revision 24464)
@@ -57,5 +57,6 @@
 	       "languageMetadata" => "languagemetadata",
 	       "buildType" => "buildtype",
-           "buildOption" => "buildOption"
+	       "orthogonalBuildTypes" => "orthogonalbuildtypes",
+	       "buildOption" => "buildOption"
 	       };
 # A hash structure which is returned by sub read_cfg_file.
@@ -79,5 +80,5 @@
 # ("plugin", "option")
 my $currentIndex = 0;
-my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage)$/;
+my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/;
 my $arrayarrayexp= q/^(plugin|classifier)$/; #|buildOption)$/;
 my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here
@@ -129,4 +130,5 @@
     my $value = $_{'value'};
     my $type = $_{'type'};
+    my $orthogonal = $_{'orthogonal'};
 
     # for subcollections
@@ -169,13 +171,19 @@
     
     #@ Handling indexer: mgpp/mg/lucene; stringexp
+    #@ Handling orthogonal indexers: audioDB; arrayexp
     elsif ($element eq "search") {
-      $data->{'buildtype'} = $type;
+	if ((defined $orthogonal) && ($orthogonal =~ m/^(true|on|1)$/i)) {
+	    push(@{$data->{'orthogonalbuildtypes'}},$type);
+	}
+	else {
+	    $data->{'buildtype'} = $type;
+	}
     }
 	
-	elsif ($element eq "store_metadata_coverage")
-	{
-		print STDERR "*&*&*&*&*& HERE &*&*&*&*&*&*";
-	  $data->{'store_metadata_coverage'} = $value;
-	}
+    elsif ($element eq "store_metadata_coverage")
+    {
+##	print STDERR "*&*&*&*&*& HERE &*&*&*&*&*&*";
+	$data->{'store_metadata_coverage'} = $value;
+    }
 
     #@ Handling searchtype: plain,form; arrayexp
@@ -363,4 +371,5 @@
     print STDERR "*** default level: ".$data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"});
     print STDERR "*** build type: ".$data->{"buildtype"}."\n" if (defined $data->{"buildtype"});
+    print STDERR "*** orthogonal build types: ".join(",",$data->{"orthogonalbuildtypes"})."\n" if (defined $data->{"orthogonalbuildtypes"});
     print STDERR "*** search types: \n";
     print STDERR join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});
