Changeset 29176
- Timestamp:
- 2014-08-08T16:57:34+12:00 (10 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/perllib/solrbuilder.pm
r29170 r29176 282 282 foreach my $ifm (@{$self->{'build_cfg'}->{'indexfieldmap'}}) { 283 283 284 my ($f ield) = ($ifm =~ m/^.*->(.*)$/);284 my ($fullfieldname, $field) = ($ifm =~ m/^(.*)->(.*)$/); 285 285 286 286 $schema_insert_xml .= " "; # indent … … 297 297 else 298 298 { 299 $schema_insert_xml .= "type=\"text_en_splitting\" "; 299 #$schema_insert_xml .= "type=\"text_en_splitting\" "; 300 301 # original default solr field type for all fields is text_en_splitting 302 my $solrfieldtype = "text_en_splitting"; 303 if(defined $self->{'collect_cfg'}->{'indexfieldoptions'}->{$fullfieldname}->{'solrfieldtype'}) { 304 $solrfieldtype = $self->{'collect_cfg'}->{'indexfieldoptions'}->{$fullfieldname}->{'solrfieldtype'}; 305 #print STDERR "@@@@#### found TYPE: $solrfieldtype\n"; 306 } 307 $schema_insert_xml .= "type=\"$solrfieldtype\" "; 308 300 309 } 301 310 # set termVectors=\"true\" when term vectors info is required, -
main/trunk/greenstone2/perllib/collConfigxml.pm
r28034 r29176 53 53 "defaultIndexLanguage" => "defaultlanguage", 54 54 "index" => "indexes", 55 "indexfieldoptions" => "indexfieldoptions", 55 56 "sort" => "sortfields", 56 57 "facet" => "facetfields", … … 86 87 # ("plugin", "option") 87 88 my $currentIndex = 0; 88 my $arrayexp = q/^(index|sort|facet|level|indexOption|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/; 89 90 my $structexp = q/^(index)$/; 91 # structexp contains a hashmap of option(name, value) pairs per index name like allfields/ZZ or titles/TI 92 # e.g. <index name="allfields"> 93 # <displayItem ... /> 94 # <option name="solrfieldtype" value="text_ja" /> 95 # </index> 96 97 my $arrayexp = q/^(sort|facet|level|indexOption|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/; 98 #my $arrayexp = q/^(index|sort|facet|level|indexOption|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/; 89 99 my $arrayarrayexp = q/^(plugin|classifier)$/; #|buildOption)$/; 90 100 my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here … … 199 209 #} 200 210 201 #@ Handle index|sort|facet|level|indexOption|indexSubcollection|indexLanguage211 #@ Handle sort|facet|level|indexOption|indexSubcollection|indexLanguage 202 212 elsif ($element =~ /$arrayexp/) { 203 213 my $key = $nameMap->{$element}; # … … 210 220 } 211 221 } 222 223 #@ Handle index which can have options as children to be put in a map: <option name="name" value="value" /> 224 elsif ($element =~ /$structexp/) { 225 # find the gs2 mapping name 226 $currentLevel = $element; 227 228 # for GS2, 'indexes' should be an arrayexp, so maintain that part of the code as it is 229 my $key = $nameMap->{$element}; # 'indexes' 230 if (!defined $data->{$key}) { 231 $data->{$key} = []; 232 } 233 234 if (defined $name) { 235 push (@{$data->{$key}},$name); 236 } 237 } 238 239 #@ Handling the option elements in each index structure, if any, only for GS2 240 elsif ($currentLevel =~ /$structexp/ && $element eq "option") { 241 # find the gs2 mapping name for classifier and plugin 242 my $key = $nameMap->{$currentLevel."fieldoptions"}; # my $key = $currentLevel."fieldoptions"; # indexfieldoptions 243 244 # The last element of the 'indexes' array contains the name of the index currently being processed 245 # e.g. "allfields" 246 my $indexKey = $nameMap->{$currentLevel}; # 'indexes' 247 my $arrSize = scalar( @{$data->{$indexKey}} ); # length of 'indexes' array 248 my $indexName = @{$data->{$indexKey}}[$arrSize-1]; # name of index currently being processed in prev elsif 249 250 if (!defined $data->{$key}) { 251 $data->{$key} = {}; # 'indexoptions' is a new hashmap 252 } 253 if (defined $name and $name =~ /\w/ && defined $value and $value =~ /\w/) { 254 # we have a name and value to this option, add them as options associated with the current index 255 256 if (!defined $data->{$key}->{$indexName}) { 257 $data->{$key}->{$indexName} = {}; # indexoptions -> allfields is a new hashmap 258 } 259 260 $data->{$key}->{$indexName}->{$name} = $value; 261 262 #print STDERR "@@@ Found: Value: data->{'indexfieldoptions'}->{$indexName}->{$name}: " . $data->{'indexfieldoptions'}->{$indexName}->{$name} . "\n"; 263 } 264 } 265 212 266 # importOption and buildOption, just stored at top level, name=value, 213 267 # as per gs2 version
Note:
See TracChangeset
for help on using the changeset viewer.