/[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 94 - (show 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 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 $self->{log} = $log;
47
48 my $est_cfg = $c->config->{hyperestraier};
49 $est_cfg->{'log'} = $log;
50
51 $log->debug("using config:" . Dumper($est_cfg) );
52
53 $self->{est} = new WebPAC::Search::Estraier( %{ $est_cfg } );
54
55 return $self;
56
57 }
58
59 sub search {
60 my ( $self, $query ) = @_;
61
62 $self->{log}->debug("search got query: $query<--");
63
64 my @results = $self->{est}->search(
65 query => $query,
66 attr => [ '@uri' ],
67 max => 100,
68 );
69
70 return @results;
71 }
72
73
74
75
76 =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