line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Manoc::Model::ManocDB; |
2
|
|
|
|
|
|
|
#ABSTRACT: Catalyst DBIC Schema Model for Manoc |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
14035
|
use Moose; |
|
1
|
|
|
|
|
424560
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
extends 'Catalyst::Model::DBIC::Schema'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.99.2'; ##TRIAL VERSION |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8892
|
use namespace::autoclean; |
|
1
|
|
|
|
|
6210
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->config( schema_class => 'App::Manoc::DB', ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'search_engine' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'App::Manoc::Search::Engine', |
17
|
|
|
|
|
|
|
lazy => 1, |
18
|
|
|
|
|
|
|
builder => '_build_search_engine', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _build_search_engine { |
22
|
0
|
|
|
0
|
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
return App::Manoc::Search::Engine->new( { schema => $self->schema } ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub search { |
28
|
0
|
|
|
0
|
|
|
my ( $self, $query_string, $params ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $engine = $self->search_engine; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $q = App::Manoc::Search::Query->new( { search_string => $query_string } ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# use params to refine query |
35
|
0
|
0
|
0
|
|
|
|
if ( $params->{limit} && !defined( $q->limit ) ) { |
36
|
0
|
|
|
|
|
|
$q->limit( ( $params->{limit} ) ); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
0
|
0
|
|
|
|
if ( $params->{type} && !defined( $q->query_type ) ) { |
39
|
0
|
|
|
|
|
|
$q->query_type( $params->{type} ); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
$q->parse; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $engine->search($q); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
App::Manoc::Model::ManocDB - Catalyst DBIC Schema Model for Manoc |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 2.99.2 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L<Catalyst::Model::DBIC::Schema> Model using schema L<App::Manoc::DB> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 search( $query_string, $params ) |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Run query using L<App::Manoc::Search::Engine>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHORS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over 4 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Gabriele Mambrini <gmambro@cpan.org> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Enrico Liguori |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Gabriele Mambrini. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
90
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |