| 1 | package Plucene; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Plucene - A Perl port of the Lucene search engine | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | =head2 Create Documents by adding Fields: | ||
| 10 | |||
| 11 | my $doc = Plucene::Document->new; | ||
| 12 | $doc->add(Plucene::Document::Field->Text(content => $content)); | ||
| 13 | $doc->add(Plucene::Document::Field->Text(author => "Your Name")); | ||
| 14 | |||
| 15 | =head2 Choose Your Analyser and add documents to an Index Writer | ||
| 16 | |||
| 17 | my $analyzer = Plucene::Analysis::SimpleAnalyzer->new(); | ||
| 18 | my $writer = Plucene::Index::Writer->new("my_index", $analyzer, 1); | ||
| 19 | |||
| 20 | $writer->add_document($doc); | ||
| 21 | undef $writer; # close | ||
| 22 | |||
| 23 | =head3 Search by building a Query | ||
| 24 | |||
| 25 | my $parser = Plucene::QueryParser->new({ | ||
| 26 | analyzer => Plucene::Analysis::SimpleAnalyzer->new(), | ||
| 27 | default => "text" # Default field for non-specified queries | ||
| 28 | }); | ||
| 29 | my $query = $parser->parse('author:"Your Name"'); | ||
| 30 | |||
| 31 | =head3 Then pass the Query to an IndexSearcher and collect hits | ||
| 32 | |||
| 33 | my $searcher = Plucene::Search::IndexSearcher->new("my_index"); | ||
| 34 | |||
| 35 | my @docs; | ||
| 36 | my $hc = Plucene::Search::HitCollector->new(collect => sub { | ||
| 37 | my ($self, $doc, $score) = @_; | ||
| 38 | push @docs, $searcher->doc($doc); | ||
| 39 | }); | ||
| 40 | |||
| 41 | $searcher->search_hc($query => $hc); | ||
| 42 | |||
| 43 | =head1 DESCRIPTION | ||
| 44 | |||
| 45 | Plucene is a fully-featured and highly customizable search engine toolkit | ||
| 46 | based on the Lucene API. (L<http://jakarta.apache.org/lucene>) | ||
| 47 | |||
| 48 | It is not, in and of itself, a functional search engine - you are expected | ||
| 49 | to subclass and tie all the pieces together to suit your own needs. | ||
| 50 | The synopsis above gives a rough indication of how to use the engine | ||
| 51 | in simple cases. See L<Plucene::Simple> for one example of tying it | ||
| 52 | all together. | ||
| 53 | |||
| 54 | The tests shipped with Plucene provide a variety of other examples of | ||
| 55 | how use this. | ||
| 56 | |||
| 57 | =head1 EXTENSIONS | ||
| 58 | |||
| 59 | Plucene comes shipped with some default Analyzers. However it is | ||
| 60 | expected that users will want to create Analyzers to meet their own | ||
| 61 | needs. To avoid namespace corruption, anyone releasing such Analyzers | ||
| 62 | to CPAN (which is encouraged!) should place them in the namespace | ||
| 63 | Plucene::Plugin::Analyzer::. | ||
| 64 | |||
| 65 | =head1 DOCUMENTATION | ||
| 66 | |||
| 67 | Although most of the Perl modules should be well documented, | ||
| 68 | the Perl API mirrors Lucene's to such an extent that reading | ||
| 69 | Lucene's documentation will give you a good idea of how to do more | ||
| 70 | advanced stuff with Plucene. See particularly the ONJava articles | ||
| 71 | L<http://www.onjava.com/pub/a/onjava/2003/01/15/lucene.html> and | ||
| 72 | L<http://www.onjava.com/pub/a/onjava/2003/03/05/lucene.html>. These are | ||
| 73 | brilliant introductions to the concepts surrounding Lucene, how it works, | ||
| 74 | and how to extend it. | ||
| 75 | |||
| 76 | =head1 COMPATIBILITY | ||
| 77 | |||
| 78 | For the most part Lucene and Plucene indexes are created in the same | ||
| 79 | manner. However, due to current implementation details, the indexes will | ||
| 80 | generally not be compatible. It should theoretically be possible to | ||
| 81 | convert index files in either direction between Plucene and Lucene, but | ||
| 82 | no tools are currently provided to do so. | ||
| 83 | |||
| 84 | As Plucene is still undergoing development, we cannot guarantee index | ||
| 85 | format compatibility across releases. If you're using Plucene in | ||
| 86 | production code, you need to ensure that you can recreate the indexes. | ||
| 87 | |||
| 88 | =head1 MISSING FEATURES | ||
| 89 | |||
| 90 | The following features have not yet been fully implemented: | ||
| 91 | |||
| 92 | =over 4 | ||
| 93 | |||
| 94 | =item * | ||
| 95 | |||
| 96 | Wildcard searches | ||
| 97 | |||
| 98 | =item * | ||
| 99 | |||
| 100 | Range searches | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | =head1 MAILING LIST | ||
| 105 | |||
| 106 | Bug reports, patches, queries, discussion etc should be addressed to | ||
| 107 | the mailing list. More information on the list can be found at: | ||
| 108 | |||
| 109 | L<http://www.kasei.com/mailman/listinfo/plucene> | ||
| 110 | |||
| 111 | =head1 AUTHORS | ||
| 112 | |||
| 113 | Initially ported by Simon Cozens and Marc Kerr. | ||
| 114 | |||
| 115 | Currently maintained by Tony Bowden and Marty Pauley. | ||
| 116 | |||
| 117 | Original Java Lucene by Doug Cutting and others. | ||
| 118 | |||
| 119 | =head1 THANKS | ||
| 120 | |||
| 121 | The initial development and ongoing maintenance of Plucene has been | ||
| 122 | funded and supported by Kasei L<http://www.kasei.com/> | ||
| 123 | |||
| 124 | =head1 LICENSE | ||
| 125 | |||
| 126 | This software is licensed under the same terms as Perl itself. | ||
| 127 | |||
| 128 | =cut | ||
| 129 | |||
| 130 | use strict; | ||
| 131 | use warnings; | ||
| 132 | |||
| 133 | our $VERSION = "1.25"; | ||
| 134 | |||
| 135 | 1; |