Plucene::TestCase - Handy functions when testing Plucene
use Test::More tests => 10; use Plucene::TestCase; new_index { add_document( foo => "bar" ); }; re_index { add_document( foo => "baz" ); } with_reader { $READER->whatever; } my $hits = search("foo:ba*");
$DIR
A directory which is created for the purposes of this test, in which the index will be placed. It will normally be cleaned up at the end of the test, unless $Plucene::TestCase::DEBUG is set to allow you to peruse the entrails.
$Plucene::TestCase::DEBUG
$WRITER
A variable holding the current Index::Writer object, if there is one.
Index::Writer
$READER
A variable holding the current Index::Reader object, if there is one.
Index::Reader
$ANALYZER
A variable holding the class name of the desired Analysis::Analyzer class.
Analysis::Analyzer
Create a new index, and do the following stuff in the block before closing the index writer. $WRITER is set for the duration of the block.
The optional parameter should be the class name of the analyzer to use; if not specified, the value from $ANALYZER, which in turn defaults to Plucene::Analysis::SimpleAnalyzer, will be used.
Plucene::Analysis::SimpleAnalyzer
Same as new_index, but doesn't create a new index, rather re-uses an old one.
new_index
Add a new document to the index, with the given fields and values
Opens an index reader in $READER and runs the block.
Searches for the query given. If any fields are not specified, they will be assumed to be the default text. Returns a Plucene::Search::Hits object. The value of $ANALYZER will be used to construct an analyzer for the query string.
text
Plucene::Search::Hits
1 POD Error
The following errors were encountered while parsing the POD:
=over without closing =back
To install Plucene, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plucene
CPAN shell
perl -MCPAN -e shell install Plucene
For more information on module installation, please visit the detailed CPAN module installation guide.