Ignore:
Timestamp:
2013-06-06T11:29:54+12:00 (11 years ago)
Author:
kjdon
Message:

implementing the new build option sections_sort_on_document_metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/lucenebuildproc.pm

    r27358 r27563  
    7878}
    7979
     80sub set_sections_sort_on_document_metadata {
     81    my $self= shift (@_);
     82    my ($index_type) = @_;
     83   
     84    $self->{'sections_sort_on_document_metadata'} = $index_type;
     85}
     86
    8087sub set_sortfields {
    8188    my $self = shift (@_);
     
    360367       
    361368        my @section_metadata = @{$doc_obj->get_metadata ($section, $submeta)};
     369            if ($section ne $doc_obj->get_top_section() && defined ($self->{'sections_sort_on_document_metadata'})) {
     370            if ($self->{'sections_sort_on_document_metadata'} eq "always" || ( scalar(@section_metadata) == 0 && $self->{'sections_sort_on_document_metadata'} eq "unless_section_metadata_exists")) {
     371                push (@section_metadata, @{$doc_obj->get_metadata ($doc_obj->get_top_section(), $submeta)});
     372            }
     373            }
    362374        push (@metadata_list, @section_metadata);
    363375        }
     
    365377        foreach my $item (@metadata_list) {
    366378        &ghtml::htmlsafe($item);
    367         $new_text .= "$item ";
     379        $new_text .= "$item";
    368380        }
    369381        if ($new_text =~ /\S/) {
Note: See TracChangeset for help on using the changeset viewer.