line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Model::WebService::Solr; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
48496
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
86
|
|
4
|
2
|
|
|
2
|
|
131
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
56
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
33659
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Moose::Util::TypeConstraints; |
8
|
|
|
|
|
|
|
use WebService::Solr; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Catalyst::Model'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'server' => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
isa => 'Str', |
15
|
|
|
|
|
|
|
default => 'http://localhost:8983/solr', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'options' => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => 'HashRef', |
21
|
|
|
|
|
|
|
default => sub { {} }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'solr' => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'WebService::Solr', |
27
|
|
|
|
|
|
|
handles => qr{^[^_].*}, |
28
|
|
|
|
|
|
|
lazy_build => 1 |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _build_solr { |
34
|
|
|
|
|
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return WebService::Solr->new( $self->server, $self->options ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Catalyst::Model::WebService::Solr - Use WebService::Solr in your Catalyst application |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
package MyApp::Model::Solr; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Moose; |
52
|
|
|
|
|
|
|
use namespace::autoclean; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
extends 'Catalyst::Model::WebService::Solr'; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__PACKAGE__->config( |
57
|
|
|
|
|
|
|
server => 'http://localhost:8080/solr/', |
58
|
|
|
|
|
|
|
options => { |
59
|
|
|
|
|
|
|
autocommit => 1, |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This module helps you use remote indexes via WebService::Solr in your |
66
|
|
|
|
|
|
|
Catalyst application. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 METHODS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 solr( ) |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This is the L<WebService::Solr> instance to which all methods are delegated. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# delegates to solr->search behind the scenes |
75
|
|
|
|
|
|
|
my $response = $c->model('Solr')->search( $q ); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SEE ALSO |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * L<Catalyst> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * L<WebService::Solr> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Brian Cassidy E<lt>bricas@cpan.orgE<gt> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Matt S. Trout E<lt>mst@shadowcatsystems.co.ukE<gt> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Oleg Kostyuk E<lt>cub@cpan.orgE<gt> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Copyright 2008-2010 by Brian Cassidy |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
102
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |