/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.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

Annotation of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94 - (hide annotations)
Tue Nov 22 12:57:20 2005 UTC (18 years, 5 months ago) by dpavlin
File size: 1403 byte(s)
 r9015@llin:  dpavlin | 2005-11-22 00:36:58 +0100
 search results begin to show promise of working evenutally

1 dpavlin 92 package Webpacus::Model::WebPAC;
2    
3     use strict;
4     use warnings;
5     use lib '/data/webpac2/lib';
6 dpavlin 93 use base qw/
7     Catalyst::Model
8     WebPAC::Search::Estraier
9     /;
10 dpavlin 92 use Data::Dumper;
11    
12     =head1 NAME
13    
14     Webpacus::Model::WebPAC - Catalyst Model
15    
16     =head1 SYNOPSIS
17    
18     See L<Webpacus> and L<WebPAC>.
19    
20     =head1 DESCRIPTION
21    
22     Catalyst Model for access to WebPAC data.
23    
24     =head2 new
25    
26     Configuration for hyperestraier in C<config.yaml> like this:
27    
28     --- #YAML:1.0
29     # DO NOT USE TABS FOR INDENTATION OR label/value SEPARATION!!!
30    
31     # configuration for hyper estraier full text search engine
32     hyperestraier:
33     url: 'http://localhost:1978/node/webpac2'
34     user: 'admin'
35     passwd: 'admin'
36    
37     =cut
38    
39     sub new {
40     my ( $self, $c, $config ) = @_;
41    
42     $self = $self->NEXT::new($c, $config);
43     $self->config($config);
44    
45     my $log = $c->log;
46 dpavlin 94 $self->{log} = $log;
47 dpavlin 92
48 dpavlin 93 my $est_cfg = $c->config->{hyperestraier};
49     $est_cfg->{'log'} = $log;
50 dpavlin 92
51 dpavlin 93 $log->debug("using config:" . Dumper($est_cfg) );
52 dpavlin 92
53 dpavlin 93 $self->{est} = new WebPAC::Search::Estraier( %{ $est_cfg } );
54 dpavlin 92
55     return $self;
56    
57     }
58    
59 dpavlin 93 sub search {
60     my ( $self, $query ) = @_;
61    
62 dpavlin 94 $self->{log}->debug("search got query: $query<--");
63    
64 dpavlin 93 my @results = $self->{est}->search(
65     query => $query,
66     attr => [ '@uri' ],
67     max => 100,
68     );
69    
70 dpavlin 94 return @results;
71 dpavlin 93 }
72    
73    
74    
75    
76 dpavlin 92 =head1 AUTHOR
77    
78     Dobrica Pavlinusic
79    
80     =head1 LICENSE
81    
82     This library is free software, you can redistribute it and/or modify
83     it under the same terms as Perl itself.
84    
85     =cut
86    
87     1;

  ViewVC Help
Powered by ViewVC 1.1.26