Changeset 27301

Show
Ignore:
Timestamp:
06.05.2013 15:19:40 (6 years ago)
Author:
jmt12
Message:

You can now use the indexname and indexlevel options to buildcol to selectively build lucene indexes

Files:
1 modified

Legend:

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

    r25723 r27301  
    226226sub build_indexes { 
    227227    my $self = shift (@_); 
    228     my ($indexname) = @_; 
     228    my ($indexname, $indexlevel) = @_; 
    229229    my $outhandle = $self->{'outhandle'}; 
    230230 
     
    238238    } 
    239239 
    240     # Have we got para index? 
    241     foreach my $level (keys %{$self->{'levels'}}) { 
    242     if ($level =~ /paragraph/) { 
    243         print $outhandle "Warning: Paragraph level indexing not supported by Lucene/Solr\n"; 
    244         last; 
    245     } 
     240    # Determine what levels of index we want to build (a user may a specific 
     241    # level to index by using indexlevel parameter) [jmt12] 
     242    my @desired_indexlevels; 
     243    foreach my $level (keys %{$self->{'levels'}}) 
     244    { 
     245      # ignore paragraph levels as they are unsupported in Lucene 
     246      if ($level =~ /paragraph/) 
     247      { 
     248        print $outhandle "WARNING: Paragraph level indexing not supported by Lucene. Ignoring index\n"; 
     249      } 
     250      # build only the requested level if specified 
     251      elsif (defined $indexlevel && $indexlevel eq $level) 
     252      { 
     253        push (@desired_indexlevels, $level); 
     254        last; 
     255      } 
     256      # otherwise build all levels defined 
     257      else 
     258      { 
     259        push (@desired_indexlevels, $level); 
     260      } 
    246261    } 
    247262 
     
    256271 
    257272        my $idx = $self->{'index_mapping'}->{$index}; 
    258         foreach my $level (keys %{$self->{'levels'}}) { 
     273            # we now iterate through the filtered list of index levels [jmt12] 
     274        foreach my $level (@desired_indexlevels) { 
    259275        next if $level =~ /paragraph/; # we don't do para indexing 
    260276        my ($pindex) = $level =~ /^(.)/;