Class::Indexed : An abstract class providing fine-grained and incremental update fulltext indexing for classes
use Class::Indexed;
our @ISA = qw(Class::Indexed);
# build the index and metadata tables Class::Indexed->build_index_tables(database=>$db,host=>$host,username=>$user,password=>$password);
# set which attributes / fields are to be indexed and their weighting, etc $self->indexed_fields ( dbh=>$dbh, key=>'Pub_ID', fields=>[ { name=>'Pub_Name', weight=>1 }, ], );
# index an object $self->index_object();
# index a field or attribute of an object $self->index_field($self->{Pub_ID}, $field, $value);
# remove the object from the metadata and index tables $self->delete_location();
# add the object to the metadata table $self->add_location();
This abstract class provides inherited indexing functionality to any class using it as a superclass.
Class::Indexed is designed to provide most of the functionality described in the article : 'Adding Search Functionality to Perl Applications' ( http://www.perl.com/pub/a/2003/09/25/searching.html ) and I recommend you read it through to gain understanding of the code and principles involved.
see the examples for the best explaination of how to use this class
None by default.
builds the index and metadata tables, you need to run this before you can use the indexing
my $success = Class::Indexed->build_index_tables(database=>$db,host=>$host,username=>$user,password=>$password);
indexes the object, updates the metadata if required
$self->index_object();
before you can call index_object you must set the fields to be indexed with the indexed_fields method
indexes a particular field or attribute of the object
$self->index_field($fieldname,$value)
takes the name of the attribute/field and the new value
before you can call index_field you must set the fields to be indexed with the indexed_fields method
remove the object from the metadata and index tables
$self->delete_location();
add the object to the metadata table
$self->add_location();
set which attributes / fields are to be indexed and their weighting, etc $self->indexed_fields ( dbh=>$dbh, key=>'Pub_ID', fields=>[ { name=>'Pub_Name', weight=>1 }, ], );
Aaron J. Trevena, <aaron.trevena@droogs.org>
perl.
To install Class::Indexed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Indexed
CPAN shell
perl -MCPAN -e shell install Class::Indexed
For more information on module installation, please visit the detailed CPAN module installation guide.