NAME

Rose::DBx::Object::Indexed::Indexer::Xapian - Xapian indexer

SYNOPSIS

# from a Rose::DBx::Object::Indexed object
my $thing = MyThing->new( id => 123 )->load;
$thing->write_index('insert');

# standalone
my $indexer = MyThing->init_indexer;
while (my $thing = $thing_iterator->next) {
   $indexer->insert($thing);
}

init_indexer_class

Returns 'SWISH::Prog::Xapian::Indexer'.

make_doc( rdbo_obj )

Returns a SWISH::Prog::Doc instance for rdbo_obj.

run( args )

Calls the superclass method and then finish() on the swish_indexer(). Note that the explicit call to finish() means that a new indexer is spawned for each insert(), update() or delete(). If you are trying to do bulk index updates, avoid this kind of overhead and do not call run(). Instead, do something like:

my $swish_indexer = $object->swish_indexer;
my $indexer       = $object->indexer;

foreach my $obj (@list_of_objects) {
   my $doc = $indexer->make_doc($obj);
   $swish_indexer->process($doc);
}

$swish_indexer->finish(); # must do this to commit the index transaction.

insert( rdbo_obj )

Calls run() with the appropriate arguments.

update( rdbo_obj )

Calls run() with the appropriate arguments.

delete( rdbo_obj )

Calls run() with the appropriate arguments.

AUTHOR

Peter Karman, <karman@cpan.org>

BUGS

Please report any bugs or feature requests to bug-rose-dbx-object-indexed@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2010 by Peter Karman.

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