/[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 370 by dpavlin, Thu Jun 17 17:25:12 2004 UTC revision 407 by dpavlin, Sun Sep 5 17:54:51 2004 UTC
# Line 12  use Carp; Line 12  use Carp;
12    
13  use lib './lib';  use lib './lib';
14  use WebPAC;  use WebPAC;
15    use WebPAC::jsFind;
16    
17  my $webpac = new WebPAC(  my $webpac = new WebPAC(
18          code_page => 'ISO-8859-2',          code_page => 'ISO-8859-2',
19          limit_mfn => 500,  #       limit_mfn => 100,
20          debug => 1,  #       debug => 1,
21    ) || die;
22    
23    my $log = $webpac->_get_logger();
24    
25    my $index = new WebPAC::jsFind(
26            index_path => './out/index',
27            keys => 80,
28  ) || die;  ) || die;
29    
30  $|=1;  $|=1;
# Line 29  my $maxmfn = $webpac->open_isis( Line 37  my $maxmfn = $webpac->open_isis(
37  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
38  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
39          { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },          { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
40            { 'key' => '900_mfn:v900', 'val' => 'v000' },
41          ],          ],
42  );  );
43    
44  print "rows: $maxmfn\n\n";  $log->info("rows: $maxmfn");
45    
46  $webpac->open_import_xml(type => 'isis_hidra_ths');  $webpac->open_import_xml(type => 'isis_hidra_ths');
47    
# Line 40  while (my $rec = $webpac->fetch_rec) { Line 49  while (my $rec = $webpac->fetch_rec) {
49    
50          my @ds = $webpac->data_structure($rec);          my @ds = $webpac->data_structure($rec);
51    
52          print $webpac->output(          if ($log->is_debug) {
53                  template => 'text.tt',                  $log->debug("rec = ",Dumper($rec));
54                  data => \@ds,                  $log->debug("ds = ",Dumper(\@ds));
55          ) if (@ds);          }
56    
57            next if (! @ds);
58    
59            my $filename = $webpac->{'current_filename'};
60    
61            if ($filename) {
62                    open(OUT,"> $filename") || $log->logdie("can't open output '$filename': $!");
63                    print OUT $webpac->output(
64                            template => 'html.tt',
65                            data => \@ds,
66                            headline => $webpac->{'headline'},
67                    );
68                    close(OUT);
69            } else {
70                    print $webpac->output(
71                            template => 'text.tt',
72                            data => \@ds,
73                            headline => $webpac->{'headline'},
74                    );
75            }
76    
77            my $headline = $webpac->{'headline'};
78    
79            my $f = $filename;
80            $f =~ s!out/!!;
81    
82            # save into index
83            foreach my $ds (@ds) {
84                    next if (! $ds->{'swish'});
85    
86                    $index->insert(
87                            index_name => $ds->{'tag'},
88                            path => $f,
89                            headline => $headline,
90                            words => join(" ",@{$ds->{'swish'}})
91                    );
92            }
93    
94    #       print Dumper(\@ds);
95    
96  }  }
97    
98  print "## lookup ",Dumper($webpac->{'lookup'});  if ($log->is_debug) {
99  print "## data ",Dumper($webpac->{'data'});          $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));
100            $log->debug("data hash: ",Dumper($webpac->{'data'}));
101    }
102    
103    $index->close;
104    

Legend:
Removed from v.370  
changed lines
  Added in v.407

  ViewVC Help
Powered by ViewVC 1.1.26