Changeset 27329
- Timestamp:
- 2013-05-14T11:11:21+12:00 (11 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/lucenebuilder.pm
r27301 r27329 47 47 no strict 'refs'; 48 48 use util; 49 use FileUtils; 49 50 50 51 sub BEGIN { … … 64 65 # If ENABLE_LUCENE was turned off during GS compilation, then we won't be able to 65 66 # continue. Check for existence of LuceneWrapper to see if Lucene was disabled. 66 my $lucene = & util::filename_cat($ENV{'GSDLHOME'},"bin","java","LuceneWrapper.jar");67 my $lucene = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"bin","java","LuceneWrapper3.jar"); 67 68 if (! -f $lucene) { 68 69 die "***** ERROR: $lucene does not exist\n"; … … 74 75 75 76 # So where is lucene_passes.pl anyway? 76 my $lucene_passes_script = & util::filename_cat($scriptdir, "lucene_passes.pl");77 my $lucene_passes_script = &FileUtils::filenameConcatenate($scriptdir, "lucene_passes.pl"); 77 78 78 79 # So tack perl on the beginning to ensure execution … … 109 110 if (defined $buildcfg->{'indexfields'}) { 110 111 foreach $field (@{$buildcfg->{'indexfields'}}) { 111 $self->{'buildproc'}->{'indexfields'}->{$field} = 1; 112 # extraindexfields is only supposed to have extra ones in it, not those already specified in indexes. And this list has all indexes in it. But we do a check before including things from extraindexfields whether it was specified in indexes, so it all ok. 113 $self->{'buildproc'}->{'extraindexfields'}->{$field} = 1; 112 114 } 113 115 } … … 116 118 foreach $field (@{$buildcfg->{'indexfieldmap'}}) { 117 119 my ($f, $v) = $field =~ /^(.*)\-\>(.*)$/; 118 $self->{'buildproc'}->{'indexfieldmap'}->{$f} = $v; 119 $self->{'buildproc'}->{'indexfieldmap'}->{$v} = 1; 120 $self->{'buildproc'}->{'fieldnamemap'}->{$f} = $v; 121 $self->{'buildproc'}->{'fieldnamemap'}->{$v} = 1; 122 $self->{'buildproc'}->{'allindexfields'}->{$f} = 1; 120 123 } 121 124 } … … 151 154 152 155 # the text directory 153 my $text_dir = & util::filename_cat($self->{'build_dir'}, "text");154 my $build_dir = & util::filename_cat($self->{'build_dir'},"");155 & util::mk_all_dir($text_dir);156 my $text_dir = &FileUtils::filenameConcatenate($self->{'build_dir'}, "text"); 157 my $build_dir = &FileUtils::filenameConcatenate($self->{'build_dir'},""); 158 &FileUtils::makeAllDirectories ($text_dir); 156 159 157 160 my $osextra = ""; … … 209 212 $self->{'buildproc'}->set_index ($textindex); 210 213 $self->{'buildproc'}->set_indexing_text (0); 211 #$self->{'buildproc'}->set_indexfieldmap ($self->{'indexfieldmap'});212 214 $self->{'buildproc'}->set_levels ($levels); 213 215 $self->{'buildproc'}->set_db_level ($db_level); … … 306 308 # get the full index directory path and make sure it exists 307 309 my $indexdir = $self->{'index_mapping'}->{$index}; 308 & util::mk_all_dir (&util::filename_cat($build_dir, $indexdir));310 &FileUtils::makeAllDirectories (&FileUtils::filenameConcatenate($build_dir, $indexdir)); 309 311 310 312 # get any os specific stuff … … 433 435 434 436 # Get info database file path 435 my $text_directory_path = & util::filename_cat($self->{'build_dir'}, "text");437 my $text_directory_path = &FileUtils::filenameConcatenate($self->{'build_dir'}, "text"); 436 438 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $self->{'collection'}, $text_directory_path); 437 439 … … 460 462 # don't expect to pipe anything to the database so we can do away with the 461 463 # complex output handle. 462 my $assocdir = & util::filename_cat($self->{'build_dir'}, "assoc");463 & util::mk_all_dir($assocdir);464 my $assocdir = &FileUtils::filenameConcatenate($self->{'build_dir'}, "assoc"); 465 &FileUtils::makeAllDirectories ($assocdir); 464 466 $self->{'buildproc'}->set_mode ('incinfodb'); # Very Important 465 467 $self->{'buildproc'}->set_assocdir ($assocdir); -
main/trunk/greenstone2/perllib/lucenebuildproc.pm
r24460 r27329 96 96 my $lsec_level = $levels->{'section'}; 97 97 98 # gs2_id should be depricated #####99 my $gs2_id = "";100 if ($ldoc_level)101 {102 if ($self->{'db_level'} eq 'document')103 {104 $gs2_id = $self->{'num_docs'};105 }106 else107 {108 # default is section level109 $gs2_id = $self->{'num_sections'} + 1;110 }111 }112 98 my $gs2_docOID = $doc_obj->get_OID(); 113 99 my $documenttag = undef; 114 100 my $documentendtag = undef; 115 101 116 #$documenttag = "<$doc_tag_name xmlns:gs2=\"http://www.greenstone.org/gs2\" file=\"$file\" gs2:id=\"$gs2_id\" gs2:docOID=\"$gs2_docOID\" gs2:mode=\"$edit_mode\">\n";117 102 $documenttag = "<$doc_tag_name xmlns:gs2=\"http://www.greenstone.org/gs2\" file=\"$file\" gs2:docOID=\"$gs2_docOID\" gs2:mode=\"$edit_mode\">\n"; 118 103 $documentendtag = "\n</$doc_tag_name>\n"; … … 146 131 if (($indexed_doc == 0) || ($indexed_section ne "indexed_section" && $indexed_section ne "indexed_doc")) { 147 132 if ($sec_tag_name ne "") { 148 #$text .= "\n<$sec_tag_name gs2:id=\"$sec_gs2_id\" gs2:docOID=\"$sec_gs2_docOID\" gs2:mode=\"ignore\">\n";149 133 $text .= "\n<$sec_tag_name gs2:docOID=\"$sec_gs2_docOID\" gs2:mode=\"ignore\">\n"; 150 134 $text .= "\n</$sec_tag_name>\n" … … 156 140 if ($sec_tag_name ne "") 157 141 { 158 #$text .= "\n<$sec_tag_name gs2:id=\"$sec_gs2_id\" gs2:docOID=\"$sec_gs2_docOID\" gs2:mode=\"$edit_mode\">\n";159 142 $text .= "\n<$sec_tag_name gs2:docOID=\"$sec_gs2_docOID\" gs2:mode=\"$edit_mode\">\n"; 160 143 } … … 200 183 my $shortname=""; 201 184 my $new_field = 0; # have we found a new field name? 202 if (defined $self->{'indexfieldmap'}->{$real_field}) { 203 $shortname = $self->{'indexfieldmap'}->{$real_field}; 204 } 205 else { 185 if (defined $self->{'fieldnamemap'}->{$real_field}) { 186 $shortname = $self->{'fieldnamemap'}->{$real_field}; 187 } else { 206 188 $shortname = $self->create_shortname($real_field); 207 $ new_field = 1;208 }209 189 $self->{'fieldnamemap'}->{$real_field} = $shortname; 190 $self->{'fieldnamemap'}->{$shortname} = 1; 191 } 210 192 my @metadata_list = (); # put any metadata values in here 211 193 my $section_text = ""; # put the text in here … … 260 242 # add the tag 261 243 $new_text = "<$shortname index=\"1\">$new_text</$shortname>"; 244 $self->{'allindexfields'}->{$real_field} = 1; 262 245 } 263 246 # filter the text … … 271 254 # delete 272 255 $self->{'num_processed_bytes'} -= length ($new_text); 273 } 274 275 276 if ($self->{'indexing_text'} && $new_field) { 277 # we need to add to the list in indexfields 278 279 $self->{'indexfieldmap'}->{$real_field} = $shortname; 280 $self->{'indexfieldmap'}->{$shortname} = 1; 281 } 282 256 } 283 257 } 284 258 … … 302 276 &ghtml::htmlsafe($mvalue); 303 277 304 if (defined $self->{' indexfieldmap'}->{$mfield}) {305 $shortname = $self->{' indexfieldmap'}->{$mfield};278 if (defined $self->{'fieldnamemap'}->{$mfield}) { 279 $shortname = $self->{'fieldnamemap'}->{$mfield}; 306 280 } 307 281 else { 308 282 $shortname = $self->create_shortname($mfield); 309 $self->{'indexfieldmap'}->{$mfield} = $shortname; 310 $self->{'indexfieldmap'}->{$shortname} = 1; 311 } 283 $self->{'fieldnamemap'}->{$mfield} = $shortname; 284 $self->{'fieldnamemap'}->{$shortname} = 1; 285 } 286 $self->{'allindexfields'}->{$mfield} = 1; 312 287 $new_text .= "<$shortname index=\"1\">$mvalue</$shortname>\n"; 313 288 if ($allfields_index) { … … 315 290 } 316 291 317 if (!defined $self->{' indexfields'}->{$mfield}) {318 $self->{' indexfields'}->{$mfield} = 1;292 if (!defined $self->{'extraindexfields'}->{$mfield}) { 293 $self->{'extraindexfields'}->{$mfield} = 1; 319 294 } 320 295 … … 334 309 335 310 if ($allfields_index) { 336 # add the index name mapping337 $self->{'indexfieldmap'}->{"allfields"} = "ZZ";338 $self->{'indexfieldmap'}->{"ZZ"} = 1;339 311 340 312 my $new_text = "<ZZ index=\"1\">$allfields_text</ZZ>\n";
Note:
See TracChangeset
for help on using the changeset viewer.