=head1 NAME

Contentment::Index::Indexer - Interface for Index plugin indexers

=head1 SYNOPSIS

  package Contentment::MyPlugin::Indexer;

  # This isn't a requirement, but it's convenient if you only need one indexer
  use base qw( Class::Singleton );

  sub _new_instance {
      my $self = shift;
      $self->{indexes} = [ Contentment::MyPlugin::Index->instance ];
  }

  sub indexes {
      my $self = shift;

      return @{ $self->{indexes} };
  }

  sub for_generator {
      my $self      = shift;
      my $generator = shift;

      if ($generator->get_propery("my_plugin_likes_this_generator")) {
          return @{ $self->{indexes} };
      }

      else {
          return ();
      }
  }

  sub register {
      Contentment::Index->register_index(
          Contentment::MyPlugin::Indexer->instance
      );
  }

=head1 DESCRIPTION

An indexer plugin must provide two functions:

=over

=item @indexes = $indexer-E<gt>indexes

Returns a list of containing zero or more indexes. This should include all indexes and this method is used for searches or index listing. Each of these should implement the interface described in L<Contentment::Index::Index>.

=back

Finally, your plugin will need to call the C<register_index()> method (probably via the L<Contentment::Index::begin> hook) of L<Contentment::Index> so that the Index plugin knows how to find your indexer.

=head1 AUTHOR

Andrew Sterling Hanenkamp, E<lt>hanenkamp@cpan.orgE<gt>

=head1 LICENSE AND COPYRIGHT

Copyright 2005 Andrew Sterling Hanenkamp E<lt>hanenkamp@cpan.orgE<gt>.  All 
Rights Reserved.

This module is free software; you can redistribute it and/or modify it under
the same terms as Perl itself. See L<perlartistic>.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

=cut

1
