Plucene is an extremely powerful library for building search engines, but each time I build a search engine with it, I always find myself doing the same things. This module provides an abstraction layer around Plucene - not quite as abstracted as Plucene::Simple, but more abstracted than Plucene itself.

This prepares for searching the index. The only mandatory argument is dir, which tells Plucene where the index is to be found. The expand_docs and snippeter arguments are explained below; analyzer specifies which Plucene analysis class to use when tokenising the search terms, and the default argument denotes the default field for unqualified query terms.

Returns a set of documents matching the search query. The default way of "expanding" these search results is to sort them by score, and then return the value of the id field from the Plucene index.

Those more familiar with Plucene can have alternative data structures returned by providing a different expand_docs parameter to the constructor. For instance, the default doesn't actually return the score, so if you want to get at it, you can say:

expand_docs => sub { my ($self, @docs) = @_; return @docs }

This will return a list of array references; the first element in each array ref will be the Plucene::Document object, and the second will be the score.

Or, if you're dealing with Class::DBI-derived classes, you might like to try: