Changeset 15725
- Timestamp:
- 2008-05-27T15:02:16+12:00 (16 years ago)
- Location:
- gsdl/trunk/perllib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/basebuilder.pm
r15711 r15725 99 99 $self->{'collect_cfg_preserve'} = &colcfg::read_collection_cfg_xml ($colcfgname); 100 100 } 101 101 102 # get the database type for this collection from the collect.cfg file (may be undefined) 103 $self->{'infodbtype'} = $self->{'collect_cfg'}->{'infodbtype'} || ""; 104 102 105 # get the list of plugins for this collection 103 106 my $plugins = []; … … 321 324 322 325 # Get info database file path 323 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{' collection'}, $textdir);326 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $self->{'collection'}, $textdir); 324 327 325 328 print $outhandle "\n*** creating the info database and processing associated files\n" … … 333 336 if ($self->{'keepold'}) { 334 337 # reconstruct doc_obj metadata from database for all docs 335 $reconstructed_docs = &classify::reconstruct_doc_objs_metadata($ infodb_file_path);338 $reconstructed_docs = &classify::reconstruct_doc_objs_metadata($self->{'infodbtype'}, $infodb_file_path); 336 339 } 337 340 … … 342 345 } 343 346 else { 344 $infodb_handle = &dbutil::open_infodb_write_handle($infodb_file_path); 347 print STDERR "Infodbtype: " . $self->{'infodbtype'} . "\n"; 348 $infodb_handle = &dbutil::open_infodb_write_handle($self->{'infodbtype'}, $infodb_file_path); 345 349 if (!defined($infodb_handle)) 346 350 { … … 349 353 } 350 354 } 351 355 356 $self->{'buildproc'}->set_infodbtype ($self->{'infodbtype'}); 352 357 $self->{'buildproc'}->set_output_handle ($infodb_handle); 353 358 $self->{'buildproc'}->set_mode ('infodb'); … … 382 387 383 388 # output classification information 384 &classify::output_classify_info ($self->{'classifiers'}, $ infodb_handle,389 &classify::output_classify_info ($self->{'classifiers'}, $self->{'infodbtype'}, $infodb_handle, 385 390 $self->{'remove_empty_classifications'}, 386 391 $self->{'gli'}); … … 391 396 # output doclist 392 397 my @doc_list = $self->{'buildproc'}->get_doc_list(); 393 &dbutil::write_infodb_entry($infodb_handle, "browselist", { 'hastxt' => [ "0" ], 394 'childtype' => [ "VList" ], 395 'numleafdocs' => [ scalar(@doc_list) ], 396 'thistype' => [ "Invisible" ], 397 'contains' => [ join(";", @doc_list) ] }); 398 my $browselist_infodb = { 'hastxt' => [ "0" ], 399 'childtype' => [ "VList" ], 400 'numleafdocs' => [ scalar(@doc_list) ], 401 'thistype' => [ "Invisible" ], 402 'contains' => [ join(";", @doc_list) ] }; 403 print STDERR "Infodbtype: " . $self->{'infodbtype'} . "\n"; 404 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, "browselist", $browselist_infodb); 398 405 399 406 close ($infodb_handle) if !$self->{'debug'}; … … 587 594 my %collection_infodb = (); 588 595 $self->get_collection_meta_sets(\%collection_infodb); 589 &dbutil::write_infodb_entry($ infodb_handle, "collection", \%collection_infodb);596 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, "collection", \%collection_infodb); 590 597 } 591 598 -
gsdl/trunk/perllib/basebuildproc.pm
r15708 r15725 225 225 } 226 226 227 sub set_infodbtype 228 { 229 my $self = shift(@_); 230 my $infodbtype = shift(@_); 231 $self->{'infodbtype'} = $infodbtype; 232 } 233 227 234 sub set_index { 228 235 my $self = shift (@_); … … 429 436 # special case for URL metadata 430 437 if ($field =~ /^URL$/i) { 431 &dbutil::write_infodb_entry($ infodb_handle, $value, { 'section' => [ $section_OID ] });438 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, $value, { 'section' => [ $section_OID ] }); 432 439 } 433 440 … … 506 513 } 507 514 508 &dbutil::write_infodb_entry($ infodb_handle, $section_OID, \%section_infodb);515 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, $section_OID, \%section_infodb); 509 516 510 517 # output a database entry for the document number 511 518 if ($self->{'db_level'} eq "document") { 512 &dbutil::write_infodb_entry($ infodb_handle, $self->{'num_docs'}, { 'section' => [ $doc_OID ] });519 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, $self->{'num_docs'}, { 'section' => [ $doc_OID ] }); 513 520 } 514 521 else { 515 &dbutil::write_infodb_entry($ infodb_handle, $self->{'num_sections'}, { 'section' => [ $section_OID ] });522 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, $self->{'num_sections'}, { 'section' => [ $section_OID ] }); 516 523 } 517 524 -
gsdl/trunk/perllib/classify.pm
r15705 r15725 233 233 sub reconstruct_doc_objs_metadata 234 234 { 235 my ($infodb_file_path) = @_; 235 my $infodb_type = shift(@_); 236 my $infodb_file_path = shift(@_); 236 237 237 238 my %database_recs; 238 &dbutil::read_infodb_file($infodb_ file_path, \%database_recs);239 &dbutil::read_infodb_file($infodb_type, $infodb_file_path, \%database_recs); 239 240 240 241 # dig out top level doc sections … … 293 294 sub output_classify_info 294 295 { 295 my ($classifiers, $infodb_ handle, $remove_empty_classifications, $gli) = @_;296 my ($classifiers, $infodb_type, $infodb_handle, $remove_empty_classifications, $gli) = @_; 296 297 297 298 $gli = 0 unless defined $gli; … … 313 314 } 314 315 315 &print_classify_info ($infodb_handle, $classifyinfo, "", $remove_empty_classifications);316 &print_classify_info($infodb_type, $infodb_handle, $classifyinfo, "", $remove_empty_classifications); 316 317 } 317 318 … … 319 320 sub print_classify_info 320 321 { 321 my ($infodb_ handle, $classifyinfo, $OID, $remove_empty_classifications) = @_;322 my ($infodb_type, $infodb_handle, $classifyinfo, $OID, $remove_empty_classifications) = @_; 322 323 323 324 $OID =~ s/^\.+//; # just for good luck … … 381 382 #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n"; 382 383 383 &print_classify_info ($infodb_ handle, $tempinfo, $tempinfo->{'classifyOID'},384 &print_classify_info ($infodb_type, $infodb_handle, $tempinfo, $tempinfo->{'classifyOID'}, 384 385 $remove_empty_classifications); 385 386 } elsif (defined ($tempinfo->{'OID'})) { … … 426 427 #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n"; 427 428 428 &print_classify_info ($infodb_ handle, $tempinfo, "$OID.$next_subOID",429 &print_classify_info ($infodb_type, $infodb_handle, $tempinfo, "$OID.$next_subOID", 429 430 $remove_empty_classifications); 430 431 $next_subOID++; … … 438 439 if ($mdoffset_text !~ m/^;+$/); 439 440 440 &dbutil::write_infodb_entry($infodb_ handle, $OID, \%classify_infodb);441 &dbutil::write_infodb_entry($infodb_type, $infodb_handle, $OID, \%classify_infodb); 441 442 } 442 443 -
gsdl/trunk/perllib/dbutil.pm
r15722 r15725 31 31 sub get_infodb_file_path 32 32 { 33 my $infodb_type = shift(@_); 33 34 my $collection_name = shift(@_); 34 35 my $infodb_directory_path = shift(@_); 35 36 37 if ($infodb_type eq "sqlite") 38 { 39 return &get_infodb_file_path_sqlite($collection_name, $infodb_directory_path); 40 } 41 42 # Use GDBM if the infodb type is empty or not one of the values above 36 43 return &get_infodb_file_path_gdbm($collection_name, $infodb_directory_path); 37 44 } … … 40 47 sub open_infodb_write_handle 41 48 { 42 my $infodb_file_path = shift(@_); 43 49 my $infodb_type = shift(@_); 50 my $infodb_file_path = shift(@_); 51 52 if ($infodb_type eq "sqlite") 53 { 54 return &open_infodb_write_handle_sqlite($infodb_file_path); 55 } 56 57 # Use GDBM if the infodb type is empty or not one of the values above 44 58 return &open_infodb_write_handle_gdbm($infodb_file_path); 45 59 } … … 48 62 sub read_infodb_file 49 63 { 64 my $infodb_type = shift(@_); 50 65 my $infodb_file_path = shift(@_); 51 66 my $infodb_map = shift(@_); … … 57 72 sub write_infodb_entry 58 73 { 74 my $infodb_type = shift(@_); 59 75 my $infodb_handle = shift(@_); 60 76 my $infodb_key = shift(@_); 61 77 my $infodb_map = shift(@_); 62 78 63 &write_infodb_entry_gdbm($infodb_handle, $infodb_key, $infodb_map); 79 if ($infodb_type eq "sqlite") 80 { 81 return &write_infodb_entry_sqlite($infodb_handle, $infodb_key, $infodb_map); 82 } 83 84 # Use GDBM if the infodb type is empty or not one of the values above 85 return &write_infodb_entry_gdbm($infodb_handle, $infodb_key, $infodb_map); 64 86 } 65 87 -
gsdl/trunk/perllib/lucenebuilder.pm
r15718 r15725 364 364 # Get info database file path 365 365 my $text_directory_path = &util::filename_cat($self->{'build_dir'}, "text"); 366 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{' collection'}, $text_directory_path);366 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $self->{'collection'}, $text_directory_path); 367 367 368 368 # If we aren't doing an incremental addition, then we just call the super- -
gsdl/trunk/perllib/mgppbuilder.pm
r15715 r15725 708 708 $self->get_collection_meta_sets(\%collection_infodb); 709 709 $self->get_collection_meta_indexes(\%collection_infodb); 710 &dbutil::write_infodb_entry($ infodb_handle, "collection", \%collection_infodb);710 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_handle, "collection", \%collection_infodb); 711 711 } 712 712
Note:
See TracChangeset
for help on using the changeset viewer.