The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rose::DBx::Object::Indexed::Indexer - Indexer base class

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);
 }

DESCRIPTION

Rose::DBx::Object::Indexed::Indexer uses SWISH::Prog to create and maintain full-text indexes of Rose::DB::Object instances.

This class is typically accessed via Rose::DBx::Object::Indexed instances.

METHODS

Only new or overridden method are documented here.

init_invindex

Should return either a path to the index directory or a SWISH::Prog::InvIndex object. The default is a no-op, which will tell the indexer to generate a default SWISH::Prog::InvIndex object.

init_config

Should return a SWISH::Prog::Config instance. The default is a new Config instance.

init_indexer_class

The default is SWISH::Prog::Native::Indexer.

init

Just calls next::method().

init_swish_indexer

Loads and returns an instance of indexer_class().

init_prune

Should return a hash ref of relationship names to skip in serialize_object().

The default is an empty hash ref (skip nothing).

init_tree_opts

Should return array ref of key/value pairs to pass into the as_tree() method in Rose::DB::Object::Helpers. Default is an empty array.

get_primary_key( rdbo_obj )

Should return the primary key to be used as the "URL" of the indexed "document". The default return value is primary_key_uri_escaped() from the Rose::DBx::Object::MoreHelpers class.

init_max_depth

Used by serialize_object(). The default value is 1.

init_force_load

Used by serialize_object(). The default value is 1 (which is not the default value in as_tree()).

init_debug

Some messages on stderr if true. Default is false.

serialize_object( rdbo_object )

Returns rdbo_object as a hash ref, using the as_tree() Helper method.

xml_root_element( [tagname] )

Get/set the root tag name to use when serializing to XML. Default is to use the return value of get_xml_root_element().

get_xml_root_element( rdbo_obj )

Returns the name of the element to use as the top-level XML tag, by default the RDBO class name, XML-escaped.

to_xml( hash, rdbo_obj [, strip_plurals] )

Returns hash as XML, using xml_root_element() as the top-level tag.

make_doc( rdbo_obj )

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

run( rdbo_obj [, action] )

The main method. Serializes rdbo_obj and hands it to the swish_indexer() process() method.

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.

ACKNOWLEDGEMENTS

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE

Copyright 2008 by the Regents of the University of Minnesota.

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