Changeset 15704 for gsdl/trunk/perllib/classify.pm
- Timestamp:
- 2008-05-26T16:36:04+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/classify.pm
r15703 r15704 153 153 154 154 155 # takes a hashref containing the metadata for a gdbmfileentry, and extracts155 # takes a hashref containing the metadata for an infodb entry, and extracts 156 156 # the childrens numbers (from the 'contains' entry). 157 157 # assumes format is ".1;".2;".3 … … 173 173 174 174 sub recurse_sections { 175 my ($doc_obj, $children, $parentoid, $parentsection, $ gdbm_recs) = @_;175 my ($doc_obj, $children, $parentoid, $parentsection, $database_recs) = @_; 176 176 177 177 return if (!defined $children); … … 179 179 foreach my $child (sort { $a <=> $b} @$children) { 180 180 $doc_obj->create_named_section("$parentsection.$child"); 181 my $doc_db_rec = $ gdbm_recs->{"$parentoid.$child"};181 my $doc_db_rec = $database_recs->{"$parentoid.$child"}; 182 182 my $doc_db_hash = db_rec_to_hash($doc_db_rec); 183 183 … … 192 192 { 193 193 recurse_sections($doc_obj, $newchildren, "$parentoid.$child", 194 "$parentsection.$child", $ gdbm_recs);194 "$parentsection.$child", $database_recs); 195 195 } 196 196 } … … 212 212 213 213 214 # gets all the metadata from a gdbm fileentry, and puts it into a hashref214 # gets all the metadata from an infodb entry, and puts it into a hashref 215 215 sub db_rec_to_hash { 216 216 … … 235 235 my ($fulldbname) = @_; 236 236 237 # tie %gdbm_recs, 'GDBM_File', $fulldbname, &GDBM_WRCREAT, 0640; 238 239 my %gdbm_recs; 240 &unbuildutil::read_gdbm($fulldbname,\%gdbm_recs); 237 my %database_recs; 238 &unbuildutil::read_gdbm($fulldbname, \%database_recs); 241 239 242 240 … … 244 242 my %top_sections = (); 245 243 my %top_docnums = (); 246 foreach my $key ( keys % gdbm_recs )244 foreach my $key ( keys %database_recs ) 247 245 { 248 my $md_rec = $ gdbm_recs{$key};246 my $md_rec = $database_recs{$key}; 249 247 my $md_hash = db_rec_to_hash($md_rec); 250 248 … … 256 254 } 257 255 258 # for greenstone document objects based on metadata in gdbmfile256 # for greenstone document objects based on metadata in database file 259 257 my @all_docs = (); 260 258 # we need to make sure the documents were processed in the same order as … … 269 267 add_section_content ($doc_obj, $top, $doc_db_hash); 270 268 my $children = &get_children($doc_db_hash); 271 recurse_sections($doc_obj, $children, $oid, $top, \% gdbm_recs);269 recurse_sections($doc_obj, $children, $oid, $top, \%database_recs); 272 270 273 271 push(@all_docs,$doc_obj); 274 272 } 275 276 # untie %gdbm_recs;277 273 278 274 return \@all_docs;
Note:
See TracChangeset
for help on using the changeset viewer.