/[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

Annotation of /trunk2/all2all.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 407 - (hide annotations)
Sun Sep 5 17:54:51 2004 UTC (15 years ago) by dpavlin
File MIME type: text/plain
File size: 2104 byte(s)
create index with much larger B, found jsFind bug.

1 dpavlin 1 #!/usr/bin/perl -w
2    
3 dpavlin 348 =head1 NAME
4    
5 dpavlin 354 all2all.pl - basic script for all WebPAC needs
6 dpavlin 348
7     =cut
8    
9 dpavlin 1 use strict;
10     use Data::Dumper;
11 dpavlin 352 use Carp;
12 dpavlin 1
13 dpavlin 352 use lib './lib';
14 dpavlin 354 use WebPAC;
15 dpavlin 390 use WebPAC::jsFind;
16 dpavlin 348
17 dpavlin 354 my $webpac = new WebPAC(
18 dpavlin 352 code_page => 'ISO-8859-2',
19 dpavlin 407 # limit_mfn => 100,
20 dpavlin 372 # debug => 1,
21 dpavlin 352 ) || die;
22    
23 dpavlin 373 my $log = $webpac->_get_logger();
24    
25 dpavlin 390 my $index = new WebPAC::jsFind(
26     index_path => './out/index',
27 dpavlin 407 keys => 80,
28 dpavlin 390 ) || die;
29    
30 dpavlin 10 $|=1;
31 dpavlin 9
32 dpavlin 352 my $maxmfn = $webpac->open_isis(
33 dpavlin 357 filename => shift @ARGV || '/data/hidra/THS/THS',
34 dpavlin 352 lookup => [
35 dpavlin 348 { 'key' => 'd:v900', 'val' => 'v250^a' },
36 dpavlin 352 # { 'eval' => '"v901^a" eq "Podruèje"', 'key' => 'pa:v561^4:v562^4:v461^1', 'val' => 'v900' },
37     # { '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' },
39     { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
40 dpavlin 374 { 'key' => '900_mfn:v900', 'val' => 'v000' },
41 dpavlin 352 ],
42 dpavlin 54 );
43 dpavlin 3
44 dpavlin 372 $log->info("rows: $maxmfn");
45 dpavlin 170
46 dpavlin 363 $webpac->open_import_xml(type => 'isis_hidra_ths');
47    
48 dpavlin 362 while (my $rec = $webpac->fetch_rec) {
49 dpavlin 358
50 dpavlin 370 my @ds = $webpac->data_structure($rec);
51 dpavlin 366
52 dpavlin 372 if ($log->is_debug) {
53     $log->debug("rec = ",Dumper($rec));
54     $log->debug("ds = ",Dumper(\@ds));
55     }
56    
57 dpavlin 374 next if (! @ds);
58 dpavlin 366
59 dpavlin 374 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 dpavlin 398 headline => $webpac->{'headline'},
67 dpavlin 374 );
68     close(OUT);
69     } else {
70     print $webpac->output(
71     template => 'text.tt',
72     data => \@ds,
73 dpavlin 398 headline => $webpac->{'headline'},
74 dpavlin 374 );
75     }
76    
77 dpavlin 398 my $headline = $webpac->{'headline'};
78 dpavlin 390
79 dpavlin 392 my $f = $filename;
80     $f =~ s!out/!!;
81    
82 dpavlin 390 # save into index
83     foreach my $ds (@ds) {
84     next if (! $ds->{'swish'});
85    
86     $index->insert(
87     index_name => $ds->{'tag'},
88 dpavlin 392 path => $f,
89 dpavlin 390 headline => $headline,
90     words => join(" ",@{$ds->{'swish'}})
91     );
92     }
93    
94     # print Dumper(\@ds);
95    
96 dpavlin 3 }
97    
98 dpavlin 372 if ($log->is_debug) {
99     $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));
100     $log->debug("data hash: ",Dumper($webpac->{'data'}));
101     }
102 dpavlin 390
103     $index->close;
104    

Properties

Name Value
cvs2svn:cvs-rev 1.64
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26