/[hyperestraier_wrappers]/trunk/perl/scripts/cpanest
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/perl/scripts/cpanest

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by dpavlin, Sat Sep 17 00:48:32 2005 UTC revision 25 by dpavlin, Sat Sep 17 20:48:42 2005 UTC
# Line 154  if ($OPT{max}) { Line 154  if ($OPT{max}) {
154    
155  my $tb = new HyperEstraier::WAIT::Table(  my $tb = new HyperEstraier::WAIT::Table(
156          uri     => $OPT{node},          uri     => $OPT{node},
157          attr    => ['docid', 'headline', 'source', 'size', 'parent'],          attr    => ['docid', 'headline', 'source', 'size', 'parent', 'version'],
158          key     => 'docid',          key     => 'docid',
159          invindex => [ qw/name synopsis bugs description text environment example author/ ],          invindex => [ qw/name synopsis bugs description text environment example author/ ],
160          debug   => $OPT{debug},          debug   => $OPT{debug},
# Line 422  for my $tar (sort keys %ARCHIVE) { Line 422  for my $tar (sort keys %ARCHIVE) {
422    next if $OPT{match} and $ARCHIVE{$tar} !~ /$OPT{match}/o;    next if $OPT{match} and $ARCHIVE{$tar} !~ /$OPT{match}/o;
423    my $base = (split /\//, $ARCHIVE{$tar})[-1];    my $base = (split /\//, $ARCHIVE{$tar})[-1];
424    my $parent;    my $parent;
   my $parent_mdate;  
425    
426    my %attr;    my %attr;
427    
428    # logging    # logging
429    if ($OPT{trust_mtime}) {    if ($OPT{trust_mtime}) {
430      $attr{'@mdate'} = strftime('%Y-%m-%dT%H:%M:%S+00:00', gmtime($VERSION{$tar}));      $attr{'@mdate'} = strftime('%Y-%m-%dT%H:%M:%S+00:00', gmtime($VERSION{$tar}));
431      $parent_mdate = $attr{'@mdate'};      $parent->{'@mdate'} = $attr{'@mdate'};
432      printf "%-20s %10s %s\t", $tar, $attr{'@mdate'}, $base;      printf "%-20s %10s %s\t", $tar, $attr{'@mdate'}, $base;
433    } else {    } else {
434      $attr{'version'} = $VERSION{$tar};      $attr{'version'} = $VERSION{$tar};
# Line 442  for my $tar (sort keys %ARCHIVE) { Line 441  for my $tar (sort keys %ARCHIVE) {
441      print "skipping\n";      print "skipping\n";
442      next ARCHIVE;      next ARCHIVE;
443    } else {    } else {
444      $parent = $tb->insert(docid    => $base,      $parent->{_id} = $tb->insert(docid    => $base,
445                            headline => $ARCHIVE{$tar},                            headline => $ARCHIVE{$tar},
446                            %attr                            %attr
447      ) unless $OPT{test};      ) unless $OPT{test};
# Line 500  for my $tar (sort keys %ARCHIVE) { Line 499  for my $tar (sort keys %ARCHIVE) {
499          print "Please alias '$tar' to '$prefix' next time!\n";          print "Please alias '$tar' to '$prefix' next time!\n";
500          print "See alias table later.\n";          print "See alias table later.\n";
501          $NEW_ALIAS{$tar} = $prefix;          $NEW_ALIAS{$tar} = $prefix;
502          $tb->delete_by_key($parent);          $tb->delete_by_key($parent->{_id});
503          next ARCHIVE;          next ARCHIVE;
504        } else {        } else {
505          print "Assuming that tar file name $tar is a valid prefix\n";          print "Assuming that tar file name $tar is a valid prefix\n";
# Line 558  for my $tar (sort keys %ARCHIVE) { Line 557  for my $tar (sort keys %ARCHIVE) {
557        $fh->print($val);        $fh->print($val);
558        index_pod(file => $path, parent => $parent,        index_pod(file => $path, parent => $parent,
559                  text => $val,  source => $ARCHIVE{$tar},                  text => $val,  source => $ARCHIVE{$tar},
                 mdate => $parent_mdate,  
560        );        );
561      }      }
562    }    }
# Line 667  sub index_pod { Line 665  sub index_pod {
665    $record->{size} =  length($parm{'text'});    $record->{size} =  length($parm{'text'});
666    my $headline    =  $record->{name} || $did;    my $headline    =  $record->{name} || $did;
667    
668      # additional fields for Hyper Estraier
669    $record->{'@mdate'} = $parm{'mdate'} if ($parm{'mdate'});    $record->{'@mdate'} = $parm{'mdate'} if ($parm{'mdate'});
670    
671    $headline =~ s/^$DATA//o;     # $did    $headline =~ s/^$DATA//o;     # $did
# Line 678  sub index_pod { Line 677  sub index_pod {
677                  headline => $headline,                  headline => $headline,
678                  %{$record});                  %{$record});
679    } else {    } else {
680        foreach (keys %{$parm{parent}}) {
681            next if (/^_/);
682            $record->{$_} = $parm{parent}->{$_} if ($parm{parent}->{$_});
683        }
684      $tb->insert('docid'  => $did,      $tb->insert('docid'  => $did,
685                  headline => $headline,                  headline => $headline,
686                  source   => $parm{source},                  source   => $parm{source},
687                  parent   => $parm{parent},                  parent   => $parm{parent}->{_id},
688                  %{$record});                  %{$record});
689    }    }
690  }  }
# Line 780  sub wanted { Line 783  sub wanted {
783    }    }
784  }  }
785    
 sub create_table {  
   my %parm = @_;  
   
   my $access = bless {}, 'WAIT::Document::Find';  
   
   my $stem = [{  
                'prefix'    => ['isotr', 'isolc'],  
                'intervall' => ['isotr', 'isolc'],  
               }, 'isotr', 'isolc', 'split2', 'stop', 'Stem'];  
   my $text = [{  
                'prefix'    => ['isotr', 'isolc'],  
                'intervall' => ['isotr', 'isolc'],  
               },  
               'isotr', 'isolc', 'split2', 'stop'];  
   my $sound = ['isotr', 'isolc', 'split2', 'Soundex'],;  
   
   my $tb =  
     $parm{db}->create_table  
       (name     => $parm{table},  
        attr     => ['docid', 'headline', 'source', 'size', 'parent'],  
        keyset   => [['docid']],  
        layout   => $parm{layout},  
        access   => $access,  
        invindex =>  
        [  
         'name'         => $stem,  
         'synopsis'     => $stem,  
         'bugs'         => $stem,  
         'description'  => $stem,  
         'text'         => $stem,  
         'environment'  => $text,  
         'example'      => $text,  'example' => $stem,  
         'author'       => $sound, 'author'  => $stem,  
        ]  
       );  
   die "Could not create table '$parm{table}'" unless $tb;  
   $tb;  
 }  
   
786  my %MON;  my %MON;
787  my $YEAR;  my $YEAR;
788    

Legend:
Removed from v.24  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.26