Changeset 15003

Show
Ignore:
Timestamp:
22.02.2008 11:29:52 (11 years ago)
Author:
davidb
Message:

With the new ability to group collections within a top-level collection, import.pl and buildcol.pl commands can now be given collection names such as "mygroup/demo". Some of the building code -- mostly involved with generating the index files and GDBM files -- had to be updated to correctly handle such compound collection names

Location:
gsdl/trunk/perllib
Files:
5 modified

Legend:

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

    r14934 r15003  
    322322    my $dbext = ".bdb"; 
    323323    $dbext = ".ldb" if &util::is_little_endian(); 
    324     my $fulldbname = &util::filename_cat ($textdir, "$self->{'collection'}$dbext"); 
     324    my $dbname = &util::get_dirsep_tail($self->{'collection'}).$dbext; 
     325    my $fulldbname = &util::filename_cat ($textdir, $dbname); 
    325326    $fulldbname =~ s/\//\\/g if ($ENV{'GSDLOS'} =~ /^windows$/i); 
    326327 
     
    430431    $build_cfg->{'builddate'} = time; 
    431432    $build_cfg->{'buildtype'} = $self->{'buildtype'}; 
    432     $build_cfg->{'indexstem'} = $self->{'collection'}; 
     433    $build_cfg->{'indexstem'} = &util::get_dirsep_tail($self->{'collection'}); 
    433434    $build_cfg->{'stemindexes'} = $self->{'stemindexes'}; 
    434435     
  • gsdl/trunk/perllib/lucenebuilder.pm

    r13590 r15003  
    367367    my $dbext = ".bdb"; 
    368368    $dbext = ".ldb" if &util::is_little_endian(); 
    369     my $infodb_file = &util::filename_cat($self->{'build_dir'}, "text", $self->{'collection'} . $dbext); 
     369 
     370    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
     371    my $infodb_file = &util::filename_cat($self->{'build_dir'}, "text", $collect_tail . $dbext); 
    370372 
    371373    # If we aren't doing an incremental addition, then we just call the super- 
  • gsdl/trunk/perllib/mgbuilder.pm

    r12971 r15003  
    127127 
    128128    &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, "text")); 
    129     my $basefilename = "text/$self->{'collection'}"; 
     129 
     130    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
     131    my $basefilename = &util::filename_cat("text",$collect_tail); 
    130132    my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, $basefilename); 
    131133 
     
    315317    my $indexdir = $self->{'index_mapping'}->{$index}; 
    316318    &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, $indexdir)); 
     319 
     320    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
    317321    my $fullindexprefix = &util::filename_cat ($self->{'build_dir'}, $indexdir,  
    318                            $self->{'collection'}); 
     322                           $collect_tail); 
    319323    my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, "text",  
    320                            $self->{'collection'}); 
     324                           $collect_tail); 
    321325 
    322326    # get any os specific stuff 
     
    522526    my $exe = &util::get_os_exe (); 
    523527    my $mgstat_exe = &util::filename_cat($exedir, "mgstat$exe"); 
    524     my $input_file = &util::filename_cat ("text", $self->{'collection'}); 
     528 
     529    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
     530    my $input_file = &util::filename_cat ("text", $collect_tail); 
    525531    if (!-e "$mgstat_exe" || !open (PIPEIN, "mgstat$exe -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) { 
    526532    print $outhandle "Warning: Couldn't open pipe to $mgstat_exe to get additional stats\n"; 
  • gsdl/trunk/perllib/mgppbuilder.pm

    r14934 r15003  
    201201    &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, "text")); 
    202202 
    203     my $basefilename = "text/$self->{'collection'}"; 
     203    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
     204    my $basefilename = &util::filename_cat("text",$collect_tail); 
    204205    my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, $basefilename); 
    205206     
    206    my $osextra = ""; 
     207    my $osextra = ""; 
    207208    if ($ENV{'GSDLOS'} =~ /^windows$/i) { 
    208209    $fulltextprefix =~ s@/@\\@g; 
     
    402403    my $indexdir = $self->{'index_mapping'}->{$index}; 
    403404    &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, $indexdir)); 
     405 
     406    my $collect_tail = &util::get_dirsep_tail($self->{'collection'}); 
    404407    my $fullindexprefix = &util::filename_cat ($self->{'build_dir'},  
    405408                           $indexdir,  
    406                            $self->{'collection'}); 
     409                           $collect_tail); 
    407410    my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, "text",  
    408                            $self->{'collection'}); 
     411                           $collect_tail); 
    409412 
    410413    # get any os specific stuff 
  • gsdl/trunk/perllib/util.pm

    r14926 r15003  
    703703 
    704704 
     705sub get_dirsep_tail { 
     706    my ($filename) = @_; 
     707     
     708    # returns last part of directory or filename 
     709    # On unix e.g. a/b.d => b.d 
     710    #              a/b/c => c 
     711 
     712    my $dirsep = get_dirsep(); 
     713     
     714    my ($tail) = ($filename =~ m/^(?:.*?$dirsep)?(.*?)$/); 
     715 
     716    return $tail; 
     717} 
     718 
     719 
    705720# if this is running on windows we want binaries to end in 
    706721# .exe, otherwise they don't have to end in any extension