Changeset 15709
- Timestamp:
- 2008-05-27T11:44:00+12:00 (16 years ago)
- Location:
- gsdl/trunk/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/basebuilder.pm
r15700 r15709 32 32 use cfgread; 33 33 use colcfg; 34 use dbutil; 34 35 use plugin; 35 36 use util; 36 use FileHandle; 37 37 38 38 39 BEGIN { … … 564 565 565 566 566 567 sub output_collection_meta_start{567 sub get_collection_meta_sets 568 { 568 569 my $self = shift(@_); 569 my ($handle) = @_; 570 571 print $handle "[collection]\n"; 572 573 } 574 575 sub output_collection_meta_sets { 576 my $self = shift(@_); 577 my ($handle) = @_; 570 my $collection_infodb = shift(@_); 578 571 579 572 my $mdprefix_fields = $self->{'buildproc'}->{'mdprefix_fields'}; 580 581 573 foreach my $prefix (keys %$mdprefix_fields) 582 574 { 583 p rint $handle "<metadataset>$prefix\n";575 push(@{$collection_infodb->{"metadataset"}}, $prefix); 584 576 585 577 foreach my $field (keys %{$mdprefix_fields->{$prefix}}) 586 578 { 579 push(@{$collection_infodb->{"metadatalist-$prefix"}}, $field); 580 587 581 my $val = $mdprefix_fields->{$prefix}->{$field}; 588 589 print $handle "<metadatalist-$prefix>$field\n"; 590 print $handle "<metadatafreq-$prefix-$field>$val\n"; 591 } 592 593 } 594 595 } 596 597 sub output_collection_meta_end { 582 push(@{$collection_infodb->{"metadatafreq-$prefix-$field"}}, $val); 583 } 584 } 585 } 586 587 588 # default is to output the metadata sets (prefixes) used in collection 589 sub output_collection_meta 590 { 598 591 my $self = shift(@_); 599 my ($handle) = @_; 600 601 print $handle ('-' x 70) . "\n";; 602 603 } 604 605 606 # default is to output the metadata sets (prefixes) used in collection 607 608 sub output_collection_meta { 609 my $self = shift(@_); 610 my ($handle) = @_; 611 612 $self->output_collection_meta_start($handle); 613 $self->output_collection_meta_sets($handle); 614 $self->output_collection_meta_end($handle); 615 616 } 592 my $infodb_handle = shift(@_); 593 594 my %collection_infodb = (); 595 $self->get_collection_meta_sets(\%collection_infodb); 596 &dbutil::write_infodb_entry($infodb_handle, "collection", \%collection_infodb); 597 } 598 617 599 618 600 sub print_stats { -
gsdl/trunk/perllib/mgppbuilder.pm
r15687 r15709 626 626 } 627 627 628 # now only outputs stuff if you can't generate it from collectionmeta - e.g. if someone has specified 'metadata' as an index. 629 sub output_collection_meta { 628 629 sub get_collection_meta_indexes 630 { 630 631 my $self = shift(@_); 631 my ($handle) = @_;632 my $collection_infodb = shift(@_); 632 633 633 634 # define the indexed field mapping if not already done so (ie if infodb called separately from build_index) … … 635 636 $self->read_final_field_list(); 636 637 } 637 638 # do the collection info639 $self->output_collection_meta_start($handle);640 $self->output_collection_meta_sets($handle);641 638 642 639 # first do the collection meta stuff - everything without a dot … … 651 648 # <SU>Subject 652 649 # these now come from collection meta. if that is not defined, usses the metadata name 653 my $field_entry="";654 650 my $collmeta = ""; 655 651 foreach my $longfield (@{$self->{'build_cfg'}->{'indexfields'}}){ … … 662 658 if (!$collmetadefined || !defined $self->{'collect_cfg'}->{'collectionmeta'}->{$collmeta}) { 663 659 if ($longfield eq "allfields") { 664 $ field_entry .= "<$shortfield>_query:textallfields_\n";660 $collection_infodb->{$shortfield} = [ "_query:textallfields_" ]; 665 661 } elsif ($longfield eq "text") { 666 $ field_entry .= "<$shortfield>_query:texttextonly_\n";662 $collection_infodb->{$shortfield} = [ "_query:texttextonly_" ]; 667 663 } else { 668 $field_entry .= "<$shortfield>$longfield\n"; 669 } 670 } 671 } 672 print $handle $field_entry; 664 $collection_infodb->{$shortfield} = [ $longfield ]; 665 } 666 } 667 } 673 668 674 669 # now add the level names … … 680 675 if (!$collmetadefined || !defined $self->{'collect_cfg'}->{'collectionmeta'}->{$collmeta}) { 681 676 # use the default macro 682 $level_entry .= "<$levelid>" . $level_map{$levelid} . "\n"; 683 } 684 } 685 print $handle $level_entry; 677 $collection_infodb->{$levelid} = [ $level_map{$levelid} ]; 678 } 679 } 686 680 687 681 # now add subcoll meta … … 692 686 $shortname = $self->{'index_mapping'}->{$subcoll}; 693 687 if (!$collmetadefined || !defined $self->{'collect_cfg'}->{'collectionmeta'}->{".$subcoll"}) { 694 $subcoll_entry .= "<$shortname>$subcoll\n"; 695 } 696 } 697 print $handle $subcoll_entry; 688 $collection_infodb->{$shortname} = [ $subcoll ]; 689 } 690 } 698 691 699 692 # now add language meta … … 702 695 $shortname = $self->{'index_mapping'}->{$lang}; 703 696 if (!$collmetadefined || !defined $self->{'collect_cfg'}->{'collectionmeta'}->{".$lang"}) { 704 $lang_entry .= "<$shortname>$lang\n"; 705 } 706 } 707 print $handle "$lang_entry\n"; 708 709 $self->output_collection_meta_end($handle); 710 } 697 $collection_infodb->{$shortname} = [ $lang ]; 698 } 699 } 700 } 701 702 703 # default is to output the metadata sets (prefixes) used in collection 704 sub output_collection_meta 705 { 706 my $self = shift(@_); 707 my $infodb_handle = shift(@_); 708 709 my %collection_infodb = (); 710 $self->get_collection_meta_sets(\%collection_infodb); 711 $self->get_collection_meta_indexes(\%collection_infodb); 712 &dbutil::write_infodb_entry($infodb_handle, "collection", \%collection_infodb); 713 } 714 711 715 712 716 # at the end of building, we have an indexfieldmap with all the mappings,
Note:
See TracChangeset
for help on using the changeset viewer.