Changeset 13589


Ignore:
Timestamp:
2007-01-12T14:11:37+13:00 (15 years ago)
Author:
kjdon
Message:

indented the file using emacs. no code changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/lucenebuilder.pm

    r12974 r13589  
    7070    if ($exe eq ".exe")
    7171    {
    72       $self->{'full_lucene_passes_exe'} = "perl$exe \"$lucene_passes_script\"";
     72    $self->{'full_lucene_passes_exe'} = "perl$exe \"$lucene_passes_script\"";
    7373    }
    7474    else
    7575    {
    76       $self->{'full_lucene_passes_exe'} = "perl -S \"$lucene_passes_script\"";
     76    $self->{'full_lucene_passes_exe'} = "perl -S \"$lucene_passes_script\"";
    7777    }
    7878
     
    9999# this writes a nice version of the text docs
    100100sub compress_text
    101   {
     101{
    102102    my $self = shift (@_);
    103103    # we don't do anything if we don't want compressed text
     
    114114    my $osextra = "";
    115115    if ($ENV{'GSDLOS'} =~ /^windows$/i)
    116       {
    117     $text_dir =~ s@/@\\@g;
    118       }
     116    {
     117    $text_dir =~ s@/@\\@g;
     118    }
    119119    else
    120       {
    121     if ($outhandle ne "STDERR")
    122           {
    123         # so lucene_passes doesn't print to stderr if we redirect output
    124         $osextra .= " 2>/dev/null";
    125           }
    126       }
     120    {
     121    if ($outhandle ne "STDERR")
     122    {
     123        # so lucene_passes doesn't print to stderr if we redirect output
     124        $osextra .= " 2>/dev/null";
     125    }
     126    }
    127127
    128128    # get any os specific stuff
     
    138138
    139139    if ($self->{'debug'})
    140       {
    141     $handle = STDOUT;
    142       }
     140    {
     141    $handle = STDOUT;
     142    }
    143143    else
    144       {
     144    {
    145145        print STDERR "Full Path:     $full_lucene_passes\n";
    146146        print STDERR "Executable:    $full_lucene_passes_exe\n";
     
    148148        print STDERR "Build Dir:     $build_dir\n";
    149149        print STDERR "Cmd:           $full_lucene_passes_exe text $lucene_passes_sections \"$build_dir\" \"dummy\"   $osextra\n";
    150     if (!-e "$full_lucene_passes" ||
    151         !open (PIPEOUT, "| $full_lucene_passes_exe text $lucene_passes_sections \"$build_dir\" \"dummy\"   $osextra"))
    152           {
    153         print STDERR "<FatalError name='NoRunLucenePasses'/>\n</Stage>\n" if $self->{'gli'};
    154         die "lucenebuilder::build_index - couldn't run $full_lucene_passes_exe\n";
    155           }
    156     $handle = lucenebuilder::PIPEOUT;
    157       }
     150    if (!-e "$full_lucene_passes" ||
     151        !open (PIPEOUT, "| $full_lucene_passes_exe text $lucene_passes_sections \"$build_dir\" \"dummy\"   $osextra"))
     152    {
     153        print STDERR "<FatalError name='NoRunLucenePasses'/>\n</Stage>\n" if $self->{'gli'};
     154        die "lucenebuilder::build_index - couldn't run $full_lucene_passes_exe\n";
     155    }
     156    $handle = lucenebuilder::PIPEOUT;
     157    }
    158158    my $levels = $self->{'levels'};
    159159    my $gdbm_level = "document";
    160160    if ($levels->{'section'})
    161       {
    162     $gdbm_level = "section";
    163       }
     161    {
     162    $gdbm_level = "section";
     163    }
    164164
    165165    undef $levels->{'paragraph'}; # get rid of para if we had it.
     
    174174    $self->{'buildproc'}->reset();
    175175    &plugin::begin($self->{'pluginfo'}, $self->{'source_dir'},
    176            $self->{'buildproc'}, $self->{'maxdocs'});
     176           $self->{'buildproc'}, $self->{'maxdocs'});
    177177    &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
    178            "", {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
     178           "", {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
    179179    &plugin::end($self->{'pluginfo'});
    180180    close ($handle) unless $self->{'debug'};
     
    183183
    184184    print STDERR "</Stage>\n" if $self->{'gli'};
    185   }
     185}
    186186
    187187sub build_indexes {
     
    192192    my $indexes = [];
    193193    if (defined $indexname && $indexname =~ /\w/) {
    194     push @$indexes, $indexname;
     194    push @$indexes, $indexname;
    195195    } else {
    196     $indexes = $self->{'collect_cfg'}->{'indexes'};
     196    $indexes = $self->{'collect_cfg'}->{'indexes'};
    197197    }
    198198
     
    203203    # build each of the indexes
    204204    foreach $index (@$indexes) {
    205     if ($self->want_built($index)) {
    206 
    207         my $idx = $self->{'index_mapping'}->{$index};
    208         foreach my $level (keys %{$self->{'levels'}}) {
    209         next if $level =~ /paragraph/; # we don't do para indexing
    210         my ($pindex) = $level =~ /^(.)/;
    211         # should probably check that new name with level
    212         # is unique ... but currently (with doc sec and para)
    213         # each has unique first letter.
    214         $self->{'index_mapping'}->{$index} = $pindex.$idx;
    215 
    216         my $llevel = $mgppbuilder::level_map{$level};
    217         print $outhandle "\n*** building index $index at level $llevel in subdirectory " .
    218             "$self->{'index_mapping'}->{$index}\n" if ($self->{'verbosity'} >= 1);
    219         print STDERR "<Stage name='Index' source='$index' level=$llevel>\n" if $self->{'gli'};
    220 
    221         $self->build_index($index,$llevel);
    222         }
    223         $self->{'index_mapping'}->{$index} = $idx;
    224 
    225     } else {
    226         print $outhandle "\n*** ignoring index $index\n" if ($self->{'verbosity'} >= 1);
    227     }
     205    if ($self->want_built($index)) {
     206
     207        my $idx = $self->{'index_mapping'}->{$index};
     208        foreach my $level (keys %{$self->{'levels'}}) {
     209        next if $level =~ /paragraph/; # we don't do para indexing
     210        my ($pindex) = $level =~ /^(.)/;
     211        # should probably check that new name with level
     212        # is unique ... but currently (with doc sec and para)
     213        # each has unique first letter.
     214        $self->{'index_mapping'}->{$index} = $pindex.$idx;
     215
     216        my $llevel = $mgppbuilder::level_map{$level};
     217        print $outhandle "\n*** building index $index at level $llevel in subdirectory " .
     218            "$self->{'index_mapping'}->{$index}\n" if ($self->{'verbosity'} >= 1);
     219        print STDERR "<Stage name='Index' source='$index' level=$llevel>\n" if $self->{'gli'};
     220
     221        $self->build_index($index,$llevel);
     222        }
     223        $self->{'index_mapping'}->{$index} = $idx;
     224
     225    } else {
     226        print $outhandle "\n*** ignoring index $index\n" if ($self->{'verbosity'} >= 1);
     227    }
    228228    }
    229229
     
    240240#  */
    241241sub remove_document_from_database
    242   {
     242{
    243243    my ($self, $oid) = @_;
    244244    # Find the perl script to call to run lucene
     
    246246    # Call lucene_passes.pl with -remove and the document ID on the command line
    247247    `$full_lucene_passes_exe -remove "$oid"`;
    248   }
     248}
    249249# /** remove_document_from_database **/
    250250
     
    275275    my $osextra = "";
    276276    if ($ENV{'GSDLOS'} =~ /^windows$/i) {
    277     $build_dir =~ s@/@\\@g;
     277    $build_dir =~ s@/@\\@g;
    278278    } else {
    279     if ($outhandle ne "STDERR") {
    280         # so lucene_passes doesn't print to stderr if we redirect output
    281         $osextra .= " 2>/dev/null";
    282     }
     279    if ($outhandle ne "STDERR") {
     280        # so lucene_passes doesn't print to stderr if we redirect output
     281        $osextra .= " 2>/dev/null";
     282    }
    283283    }
    284284
     
    294294
    295295    foreach $subcollection (@subcollections) {
    296     if (defined ($self->{'collect_cfg'}->{'subcollection'}->{$subcollection})) {
    297         push (@$indexexparr, $self->{'collect_cfg'}->{'subcollection'}->{$subcollection});
    298     }
     296    if (defined ($self->{'collect_cfg'}->{'subcollection'}->{$subcollection})) {
     297        push (@$indexexparr, $self->{'collect_cfg'}->{'subcollection'}->{$subcollection});
     298    }
    299299    }
    300300
     
    305305    my $language_metadata = "Language";
    306306    if (defined ($self->{'collect_cfg'}->{'language_metadata'})) {
    307     $language_metadata = $self->{'collect_cfg'}->{'language_metadata'};
     307    $language_metadata = $self->{'collect_cfg'}->{'language_metadata'};
    308308    }
    309309    @languages = split /,/, $language if (defined $language);
    310310    foreach my $language (@languages) {
    311     my $not=0;
    312     if ($language =~ s/^\!//) {
    313         $not = 1;
    314     }
    315     if($not) {
    316         push (@$langarr, "!$language");
    317     } else {
    318         push (@$langarr, "$language");
    319     }
     311    my $not=0;
     312    if ($language =~ s/^\!//) {
     313        $not = 1;
     314    }
     315    if($not) {
     316        push (@$langarr, "!$language");
     317    } else {
     318        push (@$langarr, "$language");
     319    }
    320320    }
    321321
     
    326326
    327327    if ($self->{'debug'}) {
    328     $handle = STDOUT;
     328    $handle = STDOUT;
    329329    } else {
    330       print STDERR "Cmd: $full_lucene_passes_exe $opt_create_index index $lucene_passes_sections \"$build_dir\" \"$indexdir\"   $osextra\n";
    331     if (!-e "$full_lucene_passes" ||
    332         !open (PIPEOUT, "| $full_lucene_passes_exe $opt_create_index index $lucene_passes_sections \"$build_dir\" \"$indexdir\"   $osextra")) {
    333         print STDERR "<FatalError name='NoRunLucenePasses'/>\n</Stage>\n" if $self->{'gli'};
    334         die "lucenebuilder::build_index - couldn't run $lucene_passes_exe\n";
    335     }
    336     $handle = lucenebuilder::PIPEOUT;
     330    print STDERR "Cmd: $full_lucene_passes_exe $opt_create_index index $lucene_passes_sections \"$build_dir\" \"$indexdir\"   $osextra\n";
     331    if (!-e "$full_lucene_passes" ||
     332        !open (PIPEOUT, "| $full_lucene_passes_exe $opt_create_index index $lucene_passes_sections \"$build_dir\" \"$indexdir\"   $osextra")) {
     333        print STDERR "<FatalError name='NoRunLucenePasses'/>\n</Stage>\n" if $self->{'gli'};
     334        die "lucenebuilder::build_index - couldn't run $lucene_passes_exe\n";
     335    }
     336    $handle = lucenebuilder::PIPEOUT;
    337337    }
    338338
     
    340340    my $gdbm_level = "document";
    341341    if ($store_levels->{'section'}) {
    342     $gdbm_level = "section";
     342    $gdbm_level = "section";
    343343    }
    344344
    345345    my $dom_level = "";
    346346    foreach my $key (keys %$store_levels) {
    347     if ($mgppbuilder::level_map{$key} eq $llevel) {
    348         $dom_level = $key;
    349     }
     347    if ($mgppbuilder::level_map{$key} eq $llevel) {
     348        $dom_level = $key;
     349    }
    350350    }
    351351    if ($dom_level eq "") {
    352     print STDERR "Warning: unrecognized tag level $llevel\n";
    353     $dom_level = "document";
     352    print STDERR "Warning: unrecognized tag level $llevel\n";
     353    $dom_level = "document";
    354354    }
    355355
     
    367367    $self->{'buildproc'}->reset();
    368368    &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
    369            "", {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
     369           "", {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
    370370    close ($handle) unless $self->{'debug'};
    371371
     
    383383#  */
    384384sub make_infodatabase
    385   {
     385{
    386386    my $self = shift (@_);
    387387    my $outhandle = $self->{'outhandle'};
     
    397397    #       called once to generate it.
    398398    if (!$self->{'incremental_dlc'} || !(-e $infodb_file))
    399       {
     399    {
    400400        # basebuilder::make_infodatabase(@_);
    401401        # Note: this doesn't work as the direct reference means all the $self
     
    403403        $self->basebuilder::make_infodatabase(@_);
    404404        return;
    405       }
     405    }
    406406
    407407    # Carry on with an incremental addition
Note: See TracChangeset for help on using the changeset viewer.