Changeset 27563

Show
Ignore:
Timestamp:
06.06.2013 11:29:54 (6 years ago)
Author:
kjdon
Message:

implementing the new build option sections_sort_on_document_metadata

Location:
main/trunk/greenstone2/perllib
Files:
5 modified

Legend:

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

    r27482 r27563  
    404404  if ($self->{'sections_index_document_metadata'} !~ /^(never|always|unless_section_metadata_exists)$/) { 
    405405    $self->{'sections_index_document_metadata'} = 'never'; 
     406  } 
     407 
     408  if ($self->{'sections_sort_on_document_metadata'} !~ /\S/ && defined $collectcfg->{'sections_sort_on_document_metadata'}) 
     409  { 
     410    $self->{'sections_sort_on_document_metadata'} = $collectcfg->{'sections_sort_on_document_metadata'}; 
     411  } 
     412 
     413  if ($self->{'sections_sort_on_document_metadata'} !~ /^(never|always|unless_section_metadata_exists)$/) { 
     414    $self->{'sections_sort_on_document_metadata'} = 'never'; 
    406415  } 
    407416 
     
    463472  my $remove_empty_classifications = $self->{'remove_empty_classifications'}; 
    464473  my $sections_index_document_metadata = $self->{'sections_index_document_metadata'}; 
     474  my $sections_sort_on_document_metadata = $self->{'sections_sort_on_document_metadata'}; 
    465475  my $site        = $self->{'site'}; 
    466476  my $store_metadata_coverage = $self->{'store_metadata_coverage'}; 
     
    602612    { 
    603613      $this_builder->set_sections_index_document_metadata($sections_index_document_metadata); 
     614    } 
     615    if ($this_buildertype eq "lucenebuilder" && $sections_sort_on_document_metadata ne "never") 
     616    { 
     617      $this_builder->set_sections_sort_on_document_metadata($sections_sort_on_document_metadata); 
    604618    } 
    605619 
  • main/trunk/greenstone2/perllib/colcfg.pm

    r27356 r27563  
    5353# {'maxnumeric'}->string 
    5454# {'separate_cjk'}->string 
    55 # {'sections_index_document_metadata'}->string (always, unless_section_metadata_exists) 
     55# {'sections_index_document_metadata'}->string (never, always, unless_section_metadata_exists) 
     56# {'sections_sort_on_document_metadata'}->string (never, always, unless_section_metadata_exists) 
    5657# {'languagemetadata'} -> string 
    5758# {'maintainer'}->array of strings 
     
    180181                    q/sortmeta|removesuffix|removeprefix|create_images|/ . 
    181182                    q/maxnumeric|languagemetadata|/ . 
    182                     q/no_strip_html|index|sections_index_document_metadata|/ . 
     183                    q/no_strip_html|index|sections_index_document_metadata|sections_sort_on_document_metadata|/ . 
    183184                    q/store_metadata_coverage|indexname|indexlevel)$/, 
    184185                    q/(maintainer|languages|indexsubcollections|orthogonalbuildtypes|/ . 
     
    202203                 q/sortmeta|removesuffix|removeprefix|create_images|/ . 
    203204                 q/maxnumeric|languagemetadata/ . 
    204                  q/no_strip_html|index|sections_index_document_metadata)$/. 
     205                 q/no_strip_html|index|sections_index_document_metadata|sections_sort_on_document_metadata)$/. 
    205206                     q/store_metadata_coverage)$/, 
    206207                 q/^(maintainer|languages|indexsubcollections|orthogonalbuildtypes|/ . 
  • main/trunk/greenstone2/perllib/lucenebuilder.pm

    r27357 r27563  
    9292# /** new() **/ 
    9393 
     94sub set_sections_sort_on_document_metadata { 
     95    my $self = shift (@_); 
     96    my ($index) = @_; 
     97   
     98    $self->{'buildproc'}->set_sections_sort_on_document_metadata($index); 
     99} 
     100 
    94101sub is_incremental_capable 
    95102{ 
  • 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/) { 
  • main/trunk/greenstone2/perllib/strings.properties

    r27498 r27563  
    127127buildcol.no_text:Don't store compressed text. This option is useful for minimizing the size of the built indexes if you intend always to display the original documents at run time (i.e. you won't be able to retrieve the compressed text version). 
    128128 
    129 buildcol.sections_index_document_metadata:Index document level metadata at section level 
    130 buildcol.sections_index_document_metadata.never:Don't index any document metadata at section level. 
     129buildcol.sections_index_document_metadata:Add document level metadata at section level for indexing 
     130buildcol.sections_sort_on_document_metadata:(Lucene only) Add document level metadata at section level for sorting 
     131buildcol.sections_index_document_metadata.never:Don't add any document metadata at section level. 
    131132buildcol.sections_index_document_metadata.always:Add all specified document level metadata even if section level metadata of that name exists. 
    132133buildcol.sections_index_document_metadata.unless_section_metadata_exists:Only add document level metadata if no section level metadata of that name exists.