Changeset 21645 for main/trunk/greenstone2
- Timestamp:
- 2010-01-26T17:25:25+13:00 (14 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/IncrementalBuildUtils.pm
r21644 r21645 203 203 # from the info database 204 204 print STDERR "* creating incremental document for $oid\n" unless !$debug; 205 my $doc_obj = new IncrementalDocument($collection, $ oid);205 my $doc_obj = new IncrementalDocument($collection, $infodbtype, $oid); 206 206 $doc_obj->loadDocument(); 207 207 # C. Check to see if this metadata is used to build a classifier(s) and if … … 380 380 # Load the incremental document to go with this oid, as we need some 381 381 # information from it. 382 my $doc_obj = new IncrementalDocument($collection, $ oid);382 my $doc_obj = new IncrementalDocument($collection, $infodbtype, $oid); 383 383 $doc_obj->loadDocument(); 384 384 # Check if this object even exists by retrieving the docnum. -
main/trunk/greenstone2/perllib/IncrementalDocument.pm
r21564 r21645 34 34 sub new() 35 35 { 36 my ($class, $collection, $ oid) = @_;37 38 #rint STDERR "IncrementalDocument::new($collection, $ oid)\n";36 my ($class, $collection, $infodbtype, $oid) = @_; 37 38 #rint STDERR "IncrementalDocument::new($collection, $infodbtype, $oid)\n"; 39 39 40 40 # Test the parameters … … 47 47 # The collection this document object has been loaded from. 48 48 $self->{'collection'} = $collection; 49 50 # The infodbtype for the collection 51 $self->{'infodbtype'} = $infodbtype; 49 52 50 53 # An associative array of information retrieved from the info database … … 150 153 my $collection = $self->{'collection'}; 151 154 my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text"); 152 my $infodb_file_path = &dbutil::get_infodb_file_path( "gdbm", $collection, $index_text_directory_path);153 my $text = &dbutil::read_infodb_entry( "gdbm", $infodb_file_path, $self->{'oid'});155 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $collection, $index_text_directory_path); 156 my $text = &dbutil::read_infodb_entry($self->{'infodbtype'}, $infodb_file_path, $self->{'oid'}); 154 157 # For each line in the raw text, extract the key (enclosed in angle 155 158 # brackets) and the value … … 189 192 190 193 my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text"); 191 my $infodb_file_path = &dbutil::get_infodb_file_path( "gdbm", $collection, $index_text_directory_path);192 my $infodb_file_handle = &dbutil::open_infodb_write_handle( "gdbm", $infodb_file_path, "append");193 &dbutil::write_infodb_entry( "gdbm", $infodb_file_handle, $self->{'oid'}, &dbutil::convert_infodb_string_to_hash($text));194 &dbutil::close_infodb_write_handle( "gdbm", $infodb_file_handle);194 my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $collection, $index_text_directory_path); 195 my $infodb_file_handle = &dbutil::open_infodb_write_handle($self->{'infodbtype'}, $infodb_file_path, "append"); 196 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_file_handle, $self->{'oid'}, &dbutil::convert_infodb_string_to_hash($text)); 197 &dbutil::close_infodb_write_handle($self->{'infodbtype'}, $infodb_file_handle); 195 198 196 199 # There is a little bit of extra complexity when saving an incremental … … 200 203 if($doc_num >= 0) 201 204 { 202 my $text = &dbutil::read_infodb_entry( "gdbm", $infodb_file_path, $doc_num);205 my $text = &dbutil::read_infodb_entry($self->{'infodbtype'}, $infodb_file_path, $doc_num); 203 206 204 207 # If there is no reverse lookup, then add one now 205 208 if($text !~ /<section>/) 206 209 { 207 $infodb_file_handle = &dbutil::open_infodb_write_handle( "gdbm", $infodb_file_path, "append");208 &dbutil::write_infodb_entry( "gdbm", $infodb_file_handle, $doc_num, &dbutil::convert_infodb_string_to_hash("<section>" . $self->{'oid'}));209 &dbutil::close_infodb_write_handle( "gdbm", $infodb_file_handle);210 $infodb_file_handle = &dbutil::open_infodb_write_handle($self->{'infodbtype'}, $infodb_file_path, "append"); 211 &dbutil::write_infodb_entry($self->{'infodbtype'}, $infodb_file_handle, $doc_num, &dbutil::convert_infodb_string_to_hash("<section>" . $self->{'oid'})); 212 &dbutil::close_infodb_write_handle($self->{'infodbtype'}, $infodb_file_handle); 210 213 } 211 214 }
Note:
See TracChangeset
for help on using the changeset viewer.