Changeset 24460

Show
Ignore:
Timestamp:
24.08.2011 15:52:02 (8 years ago)
Author:
davidb
Message:

Code changes to support indexers that are provided through the extension mechanism

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

Legend:

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

    r24342 r24460  
    329329    my $outhandle = $self->{'outhandle'}; 
    330330 
     331    $self->pre_build_indexes(); 
     332 
    331333    my $indexes = []; 
    332334    if (defined $indexname && $indexname =~ /\w/) { 
     
    352354    } 
    353355 
    354     $self->build_indexes_extra(); 
    355  
     356    $self->post_build_indexes(); 
     357 
     358} 
     359 
     360# implement this in subclass if want to do extra stuff at before building 
     361# all the indexes 
     362sub pre_build_indexes { 
     363    my $self = shift(@_); 
     364    my ($indexname) = @_; # optional parameter 
    356365} 
    357366 
    358367# implement this in subclass if want to do extra stuff at the end of building 
    359368# all the indexes 
    360 sub build_indexes_extra { 
    361     my $self = shift(@_); 
    362      
     369sub post_build_indexes { 
     370    my $self = shift(@_);    
    363371} 
    364372 
  • main/trunk/greenstone2/perllib/lucenebuilder.pm

    r24362 r24460  
    2626########################################################################### 
    2727# /* 
    28 #  *  @version 1.0 ? 
     28#  *  @version 1.0 Automated incremental building 
    2929#  *  @version 2.0 Incremental building assistance added, including 
    3030#  *               remove_document_from_database which implements the granddad's 
     
    3333#  *               perl script is. John Rowe 
    3434#  * 
     35#  *  @authro Waikato Digital Library Research Group 
    3536#  *  @author John Rowe, DL Consulting Ltd. 
    3637#  */ 
     
    117118    } 
    118119    }        
    119      
    120120} 
    121121 
     
    227227    my $outhandle = $self->{'outhandle'}; 
    228228 
     229    $self->pre_build_indexes($indexname); 
     230 
    229231    my $indexes = []; 
    230232    if (defined $indexname && $indexname =~ /\w/) { 
     
    233235    $indexes = $self->{'collect_cfg'}->{'indexes'}; 
    234236    } 
    235     # have we got para index? 
     237 
     238    # Have we got para index? 
    236239    foreach my $level (keys %{$self->{'levels'}}) { 
    237240    if ($level =~ /paragraph/) { 
    238         print $outhandle "Warning: Paragraph level indexing not supported by Lucene\n"; 
     241        print $outhandle "Warning: Paragraph level indexing not supported by Lucene/Solr\n"; 
    239242        last; 
    240243    } 
    241244    } 
    242     # create the mapping between the index descriptions 
     245 
     246    # Create the mapping between the index descriptions 
    243247    # and their directory names (includes subcolls and langs) 
    244248    $self->{'index_mapping'} = $self->create_index_mapping ($indexes); 
     
    246250    # build each of the indexes 
    247251    foreach my $index (@$indexes) { 
     252 
    248253    if ($self->want_built($index)) { 
    249254 
     
    271276    } 
    272277 
    273     #define the final field lists 
    274     $self->make_final_field_list(); 
     278    $self->post_build_indexes(); 
    275279} 
    276280 
  • main/trunk/greenstone2/perllib/lucenebuildproc.pm

    r24404 r24460  
    239239        } # for each field in this one index 
    240240         
     241 
    241242        # now we add the text and/or metadata into new_text 
    242243        if ($section_text ne "" || scalar(@metadata_list)) { 
     
    283284         
    284285    } # foreach field 
    285  
    286286 
    287287    if ($all_metadata_specified) { 
  • main/trunk/greenstone2/perllib/mgppbuilder.pm

    r24404 r24460  
    282282 
    283283 
    284 sub build_indexes_extra { 
     284sub post_build_indexes { 
    285285    my $self = shift(@_); 
     286 
    286287    #define the final field lists 
    287288    $self->make_final_field_list(); 
     
    617618    my $collection_infodb = shift(@_); 
    618619 
    619     # define the indexed field mapping if not already done so (ie if infodb called separately from build_index) 
     620    # define the indexed field mapping if not already done so  
     621    # (i.e. if infodb called separately from build_index) 
    620622    if (!defined $self->{'build_cfg'}) { 
    621623    $self->read_final_field_list(); 
     
    703705# at the end of building, we have an indexfieldmap with all the mappings, 
    704706# plus some extras, and indexmap with any indexes in it that weren't 
    705 # specified in the index definition.  we want to make an ordered list of 
    706 # fields that are indexed, and a list of mappings that are used. this will 
     707# specified in the index definition.  We want to make an ordered list of 
     708# fields that are indexed, and a list of mappings that are used. This will 
    707709# be used for the build.cfg file, and for collection meta definition we 
    708710# store these in a build.cfg bit 
     
    763765        push (@indexfields, "$field"); 
    764766        } 
    765  
    766          
    767767    } 
    768768    } 
     
    771771    $self->{'build_cfg'}->{'indexfieldmap'} = \@indexfieldmap; 
    772772    } 
     773 
    773774    if (scalar @indexfields) { 
    774775    $self->{'build_cfg'}->{'indexfields'} = \@indexfields;