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