| 1 | package Catalyst::Model::Plucene; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use base qw/Catalyst::Base Plucene::Simple/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | use NEXT; | ||
| 6 | |||
| 7 | our $VERSION = '0.02'; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Catalyst::Model::Plucene - Plucene Model Class | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | # lib/MyApp/Model/Plucene.pm | ||
| 16 | package MyApp::Model::Plucene; | ||
| 17 | |||
| 18 | use base 'Catalyst::Model::Plucene'; | ||
| 19 | |||
| 20 | __PACKAGE__->config( path => '/tmp/myindex' ); | ||
| 21 | |||
| 22 | 1; | ||
| 23 | |||
| 24 | my $plucene = $c->comp('MyApp::Model::Plucene'); | ||
| 25 | |||
| 26 | $plucene->add( | ||
| 27 | $id1 => { $field => $term1 }, | ||
| 28 | $id2 => { $field => $term2 }, | ||
| 29 | ); | ||
| 30 | |||
| 31 | my @results = $plucene->search($search_string); | ||
| 32 | |||
| 33 | $plucene->optimize; | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | This is the C<Plucene> model class. | ||
| 38 | |||
| 39 | =head2 new | ||
| 40 | |||
| 41 | Sets path from model config. Defaults to /tmp/index | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | sub new { | ||
| 46 | my ( $class, $c, $options ) = @_; | ||
| 47 | return $class->open( $class->NEXT::new( $c, $options )->{path} | ||
| 48 | || '/tmp/index' ); | ||
| 49 | } | ||
| 50 | |||
| 51 | =head1 SEE ALSO | ||
| 52 | |||
| 53 | L<Catalyst>, L<Plucene::Simple> | ||
| 54 | |||
| 55 | =head1 AUTHOR | ||
| 56 | |||
| 57 | Sebastian Riedel, C<sri@cpan.org> | ||
| 58 | Marcus Ramberg, C<mramberg@cpan.org> | ||
| 59 | |||
| 60 | =head1 COPYRIGHT | ||
| 61 | |||
| 62 | This program is free software, you can redistribute it and/or modify it | ||
| 63 | under the same terms as Perl itself. | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 1; | ||