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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (show annotations)
Tue Nov 22 12:57:15 2005 UTC (18 years, 5 months ago) by dpavlin
File size: 1415 byte(s)
 r9014@llin:  dpavlin | 2005-11-22 00:24:47 +0100
 minor tweaks all-around

1 package Webpacus::Model::WebPAC;
2
3 use strict;
4 use warnings;
5 use lib '/data/webpac2/lib';
6 use base qw/
7 Catalyst::Model
8 WebPAC::Search::Estraier
9 /;
10 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
47 my $est_cfg = $c->config->{hyperestraier};
48 $est_cfg->{'log'} = $log;
49
50 $log->debug("using config:" . Dumper($est_cfg) );
51
52 $self->{est} = new WebPAC::Search::Estraier( %{ $est_cfg } );
53
54 # $c->stash->{est}->search(
55 # query => $c->req->params->{Title},
56 # max => 100,
57 # );
58
59 return $self;
60
61 }
62
63 sub search {
64 my ( $self, $query ) = @_;
65
66 my @results = $self->{est}->search(
67 query => $query,
68 attr => [ '@uri' ],
69 max => 100,
70 );
71
72 return \@results;
73 }
74
75
76
77
78 =head1 AUTHOR
79
80 Dobrica Pavlinusic
81
82 =head1 LICENSE
83
84 This library is free software, you can redistribute it and/or modify
85 it under the same terms as Perl itself.
86
87 =cut
88
89 1;

  ViewVC Help
Powered by ViewVC 1.1.26