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*");
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. A variable holding the current \*(C`Index::Writer\*(C' object, if there is one. A variable holding the current \*(C`Index::Reader\*(C' object, if there is one. A variable holding the class name of the desired \*(C`Analysis::Analyzer\*(C' class.
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 \*(C`Plucene::Analysis::SimpleAnalyzer\*(C', will be used.
Same as \*(C`new_index\*(C', but doesn't create a new index, rather re-uses an old one.
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 \*(C`text\*(C'. Returns a \*(C`Plucene::Search::Hits\*(C' object. The value of $ANALYZER will be used to construct an analyzer for the query string.