/[webpac2]/trunk/run.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 /trunk/run.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 74 - (hide annotations)
Sun Nov 20 20:13:39 2005 UTC (18 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1743 byte(s)
 r8988@llin:  dpavlin | 2005-11-20 20:46:12 +0100
 added real implementation for WebPAC::Output::Estraier along with run.pl
 script which run test indexing (which will in one point move to
 WebPAC::Simple or something like that)

1 dpavlin 74 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     use Cwd qw/abs_path/;
6     use File::Temp qw/tempdir/;
7     use Data::Dumper;
8     use lib './lib';
9    
10     use WebPAC::Lookup;
11     use WebPAC::Input::ISIS;
12     use WebPAC::DB;
13     use WebPAC::Normalize::XML;
14     use WebPAC::Output::TT;
15     use WebPAC::Output::Estraier;
16    
17     my $abs_path = abs_path($0);
18     $abs_path =~ s#/[^/]*$#/#;
19    
20     my $isis_file = '/data/isis_data/ps/LIBRI/LIBRI';
21    
22     my $lookup = new WebPAC::Lookup(
23     lookup_file => "$abs_path/conf/lookup/isis.pm",
24     );
25    
26     my $isis = new WebPAC::Input::ISIS(
27     code_page => 'ISO-8859-2', # application encoding
28     limit_mfn => 50,
29     );
30    
31     my $maxmfn = $isis->open(
32     filename => $isis_file,
33     code_page => '852', # database encoding
34     );
35    
36     my $path = './db/';
37    
38     my $db = new WebPAC::DB(
39     path => $path,
40     );
41    
42     my $n = new WebPAC::Normalize::XML(
43     # filter => { 'foo' => sub { shift } },
44     db => $db,
45     lookup_regex => $lookup->regex,
46     lookup => $lookup,
47     );
48    
49     $n->open(
50     tag => 'isis',
51     xml_file => "$abs_path/conf/normalize/isis_ffzg.xml",
52     );
53    
54     my $out = new WebPAC::Output::TT(
55     include_path => "$abs_path/conf/output/tt",
56     filters => { foo => sub { shift } },
57     );
58    
59     my $est = new WebPAC::Output::Estraier(
60     url => 'http://localhost:1978/node/webpac2',
61     user => 'admin',
62     passwd => 'admin',
63     database => 'ps',
64     );
65    
66     while (my $row = $isis->fetch) {
67    
68     my $mfn = $row->{'000'}->[0] || die "can't find MFN";
69    
70     my $ds = $n->data_structure($row);
71    
72     # print STDERR Dumper($row, $ds);
73    
74     my $html = $out->apply(
75     template => 'html_ffzg.tt',
76     data => $ds,
77     );
78    
79     # create test output
80    
81     my $file = sprintf('out/%02d.html', $mfn );
82     open(my $fh, '>', $file) or die "can't open $file: $!";
83     print $fh $html;
84     close($fh);
85    
86     $html =~ s#\s*[\n\r]+\s*##gs;
87    
88     # print STDERR $html;
89    
90     $est->add(
91     id => $mfn,
92     ds => $ds,
93     type => 'search',
94     );
95    
96     };

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26