package CGI::Wiki::Plugin::Indexer; use strict; use CGI::Wiki::Plugin; use Data::Dumper; use vars qw( $VERSION @ISA ); $VERSION = '0.02'; @ISA = qw( CGI::Wiki::Plugin ); sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } sub reindex { my ($self, $node, $content, $metadata) = @_; my $search = $self->indexer; my %metadata = %{ $metadata }; print STDERR (%metadata); my $indexText = $content . "\n"; foreach my $key ( qw( phone address city postcode website fax summary ) ) { $indexText .= $metadata{$key} . "\n"; } foreach my $text (@{ $metadata{category}}) { if ($text) { $indexText .= $text . "\n"; } } foreach my $text (@{ $metadata{locale}}) { if ($text) { $indexText .= $text . "\n"; } } $search->index_node($node, $indexText); return 1; } 1;