NAME

Dezi::Indexer - base indexer class

SYNOPSIS

use Dezi::Indexer;
my $indexer = Dezi::Indexer->new(
       invindex    => Dezi::InvIndex->new,
       config      => Dezi::Indexer::Config->new,
       count       => 0,
       clobber     => 1,
       flush       => 10000,
       started     => time()
);
$indexer->start;
for my $doc (@list_of_docs) {
   $indexer->process($doc);
}
$indexer->finish;

DESCRIPTION

Dezi::Indexer is a base class implementing the simplest of indexing APIs. It is intended to be subclassed, along with InvIndex, for each IR backend library.

METHODS

new( params )

Constructor. See the SYNOPSIS for default options.

params may include the following keys, each of which is also an accessor method:

clobber

Over-write any existing InvIndex.

config

A Dezi::Indexer::Config object or file name.

flush

The number of indexed docs at which in-memory changes should be written to disk.

invindex

A Dezi::InvIndex object.

test_mode

Dry run mode, just prints info on stderr but does not build index.

BUILD

Setup object. Called internally by new().

init_swish3

Returns a SWISH::3 object that uses swish3_handler. This builder method is called on Indexer construction if swish3 is uninitialized.

start

Opens the invindex() object and sets the started() time to time().

Subclasses should always call SUPER::start() if they override this method since it provides sanity checking on the InvIndex.

process( doc )

doc should be a Dezi::Indexer::Doc-derived object.

process() should implement whatever the particular IR library API requires. The default action calls swish3_handler on doc.

swish3_handler( swish3_payload )

This method is called on every document passed to process(). See the SWISH::3 documentation for what to expect in swish3_payload.

This is an abstract method. Subclasses must implement it.

finish

Closes the invindex().

count

Returns the number of documents processed.

started

The time at which the Indexer start() method was called. Returns a Unix epoch integer.

AUTHOR

Peter Karman, <perl@peknet.com>

BUGS

Please report any bugs or feature requests to bug-swish-prog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-App. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Dezi

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2008-2009 by Peter Karman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

http://swish-e.org/