Simon Cozens


Plucene::SearchEngine::Index::Base - The definitely indexer base class


This module is the base class from which both frontend and backend indiexing modules should inherit. It makes it easier for modules to create Plucene::Document objects through the intermediary of a nested hash.



    __PACKAGE__->register_handler($ext, $mime_type, $ext2, ...);

This registers the module to handle each given extension or MIME type. Base works out whether a parameter is a file extension or a MIME type.


    $self->handler_for($filename, $mime_type)

This finds the relevant handler which has been registered for the givern mime type or file name extension.


This creates a new backend object, which knows about the handler, type and indexed date for the data.


    $self->add_data($field, $type, $data);

This adds data to a backend object. A backend object represents a Plucene::Document, a hash which will later be turned into a Plucene::Document object.

The $field element should be the field name that's stored in Plucene. The $type should be one of the methods that Plucene::Document::Field can cope with - Keyword, Text, UnIndexed, UnStored - or Date, which takes a Time::Piece object as its $data.


This turns the backend's hash into a Plucene::Document.