package Wiki::Toolkit::Setup::SII; use strict; use vars qw( $VERSION ); $VERSION = '0.03'; use DBI; use Search::InvertedIndex; use Wiki::Toolkit::Search::SII; use Carp; =head1 NAME Wiki::Toolkit::Setup::SII - Set up Search::InvertedIndex indexes for Wiki::Toolkit =head1 SYNOPSIS use Wiki::Toolkit::Setup::SII; my $indexdb = Search::InvertedIndex::DB::Mysql->new( -db_name => $dbname, -username => $dbuser, -password => $dbpass, -hostname => '', -table_name => 'siindex', -lock_mode => 'EX' ); Wiki::Toolkit::Setup::SII::setup( indexdb => $indexdb ); =head1 DESCRIPTION Set up L indexes for use with L Has only one function, C, which takes one mandatory argument, C, the C object to use as the backend, and one optional argument, C, a C corresponding to existing data that you wish to (re-)index. Note that any pre-existing L indexes stored in C will be I by this function, so if you have existing data you probably want to use the C parameter to get it re-indexed. =cut sub setup { my %args = @_; my $indexdb = $args{indexdb}; croak "Must supply indexdb" unless $indexdb; # Drop indexes if they already exist. $indexdb->open; $indexdb->clear; $indexdb->close; # If we've been passed a store, index all its data. my $store = $args{store}; if ( $store ) { my @nodes = $store->list_all_nodes; my $search = Wiki::Toolkit::Search::SII->new( indexdb => $indexdb ); foreach my $node ( @nodes ) { my $content = $store->retrieve_node( $node ); $search->index_node( $node, $content ); } } } =head1 AUTHOR Kake Pugh (kake@earth.li). =head1 COPYRIGHT Copyright (C) 2002 Kake Pugh. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L, L, L =cut 1;