/[webpac2]/trunk/lib/WebPAC/Output/Estraier.pm
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/lib/WebPAC/Output/Estraier.pm

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

revision 319 by dpavlin, Sat Dec 24 11:23:17 2005 UTC revision 343 by dpavlin, Sat Jan 7 01:40:01 2006 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  use base qw/WebPAC::Common/;  use base qw/WebPAC::Common/;
7    
8  use HyperEstraier;  use Search::Estraier;
9  use Text::Iconv;  use Text::Iconv;
10  use Data::Dumper;  use Data::Dumper;
11  use LWP;  use LWP;
# Line 17  WebPAC::Output::Estraier - Create Hyper Line 17  WebPAC::Output::Estraier - Create Hyper
17    
18  =head1 VERSION  =head1 VERSION
19    
20  Version 0.08  Version 0.09
21    
22  =cut  =cut
23    
24  our $VERSION = '0.08';  our $VERSION = '0.09';
25    
26  =head1 SYNOPSIS  =head1 SYNOPSIS
27    
# Line 77  Name of database will be used to form UR Line 77  Name of database will be used to form UR
77    
78  sub new {  sub new {
79          my $class = shift;          my $class = shift;
80          my $self = {@_};          my $self = {@_};
81          bless($self, $class);          bless($self, $class);
82    
83          my $log = $self->_get_logger;          my $log = $self->_get_logger;
84    
# Line 111  sub new { Line 111  sub new {
111                  ) || $log->logdie("can't create Hyper Estraier node $self->{database}");                  ) || $log->logdie("can't create Hyper Estraier node $self->{database}");
112          }          }
113    
114          $self->{'db'} = HyperEstraier::Node->new($self->{url});          $self->{db} = Search::Estraier::Node->new( debug => 1 );
115          $self->{'db'}->set_auth($self->{'user'}, $self->{passwd});          $self->{db}->set_url($self->{url});
116            $self->{db}->set_auth($self->{user}, $self->{passwd});
117    
118          my $encoding = $self->{'encoding'} || 'ISO-8859-2';          my $encoding = $self->{encoding} || 'ISO-8859-2';
119          $log->info("using index $self->{url} with encoding $encoding");          $log->info("using index $self->{url} with encoding $encoding");
120    
121          $self->{'iconv'} = new Text::Iconv($encoding, 'UTF-8') or          $self->{iconv} = new Text::Iconv($encoding, 'UTF-8') or
122                  $log->logdie("can't create conversion from $encoding to UTF-8");                  $log->logdie("can't create conversion from $encoding to UTF-8");
123    
124          $self ? return $self : return undef;          $self ? return $self : return undef;
# Line 164  sub add { Line 165  sub add {
165          my $uri = "file:///$type/$database/$id";          my $uri = "file:///$type/$database/$id";
166          $log->debug("creating $uri");          $log->debug("creating $uri");
167    
168          my $doc = HyperEstraier::Document->new;          my $doc = Search::Estraier::Document->new;
169          $doc->add_attr('@uri', $self->{'iconv'}->convert($uri) );          $doc->add_attr('@uri', $self->{'iconv'}->convert($uri) );
170    
171          $log->debug("ds = ", sub { Dumper($args->{'ds'}) } );          $log->debug("ds = ", sub { Dumper($args->{'ds'}) } );

Legend:
Removed from v.319  
changed lines
  Added in v.343

  ViewVC Help
Powered by ViewVC 1.1.26