/[webpac]/trunk2/all2all.pl
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 /trunk2/all2all.pl

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

revision 410 by dpavlin, Sun Sep 5 21:40:57 2004 UTC revision 415 by dpavlin, Wed Sep 8 15:30:07 2004 UTC
# Line 17  use WebPAC::Index; Line 17  use WebPAC::Index;
17    
18  my $webpac = new WebPAC(  my $webpac = new WebPAC(
19          code_page => 'ISO-8859-2',          code_page => 'ISO-8859-2',
20          limit_mfn => 100,          limit_mfn => 500,
21  #       debug => 1,  #       debug => 1,
22  ) || die;  ) || die;
23    
# Line 25  my $log = $webpac->_get_logger(); Line 25  my $log = $webpac->_get_logger();
25    
26  my $index = new WebPAC::jsFind(  my $index = new WebPAC::jsFind(
27          index_path => './out/index',          index_path => './out/index',
28          keys => 80,          keys => 10,
29  ) || die;  ) || die;
30    
31  my $thes;  my $thes;
# Line 52  while (my $rec = $webpac->fetch_rec) { Line 52  while (my $rec = $webpac->fetch_rec) {
52    
53          my @ds = $webpac->data_structure($rec);          my @ds = $webpac->data_structure($rec);
54    
55          if ($log->is_debug) {          if (0 && $log->is_debug) {
56                  $log->debug("rec = ",Dumper($rec));                  $log->debug("rec = ",Dumper($rec));
57                  $log->debug("ds = ",Dumper(\@ds));                  $log->debug("ds = ",Dumper(\@ds));
58          }          }
# Line 62  while (my $rec = $webpac->fetch_rec) { Line 62  while (my $rec = $webpac->fetch_rec) {
62          my $filename = $webpac->{'current_filename'};          my $filename = $webpac->{'current_filename'};
63    
64          if ($filename) {          if ($filename) {
65                  open(OUT,"> $filename") || $log->logdie("can't open output '$filename': $!");                  $webpac->output_file(
66                  print OUT $webpac->output(                          file => $filename,
67                          template => 'html.tt',                          template => 'html.tt',
68                          data => \@ds,                          data => \@ds,
69                          headline => $webpac->{'headline'},                          headline => $webpac->{'headline'},
70                  );                  );
                 close(OUT);  
71          } else {          } else {
72                  print $webpac->output(                  print $webpac->output(
73                          template => 'text.tt',                          template => 'text.tt',
# Line 100  while (my $rec = $webpac->fetch_rec) { Line 99  while (my $rec = $webpac->fetch_rec) {
99    
100                  $thes->{$ds->{'tag'}} ||= new WebPAC::Index;                  $thes->{$ds->{'tag'}} ||= new WebPAC::Index;
101    
102                  $thes->{$ds->{'tag'}}->insert(                  foreach my $h (@{$ds->{'index'}}) {
103                          path => $f,                          $thes->{$ds->{'tag'}}->insert(
104                          headline => $headline,                                  path => $f,
105                  );                                  headline => $h,
106                            );
107                    }
108          }          }
109    
110  #       print Dumper(\@ds);  #       print Dumper(\@ds);
111    
112  }  }
113    
114  if ($log->is_debug) {  foreach my $t (keys %{$thes}) {
115    
116            my @e = $thes->{$t}->elements;
117            if (! @e) {
118                    $log->logwarn("no elements in sorted index $t?");
119                    next;
120            }
121    
122            my $file = "./out/bfilter/$t.txt";
123            $log->info("saving sorted index $t to '$file' [".scalar(@e)." elements]");
124    
125            $webpac->output_file(
126                    file => $file,
127                    template => 'index.tt',
128                    data => \@e,
129                    index_name => $t,
130            );
131    }
132    
133    if (0 && $log->is_debug) {
134          $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));          $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));
135          $log->debug("data hash: ",Dumper($webpac->{'data'}));          $log->debug("data hash: ",Dumper($webpac->{'data'}));
136          foreach my $t (keys %{$thes}) {          foreach my $t (keys %{$thes}) {

Legend:
Removed from v.410  
changed lines
  Added in v.415

  ViewVC Help
Powered by ViewVC 1.1.26