NAME
CGI::Wiki::Search::SII - Search::InvertedIndex search plugin for CGI::Wiki
SYNOPSIS
my $indexdb = Search::InvertedIndex::DB::Mysql->new( ... );
my $search = CGI::Wiki::Search::SII->new( indexdb => $indexdb );
my %wombat_nodes = $search->search_nodes("wombat");
Provides search-related methods for CGI::Wiki
METHODS
- new
-
my $indexdb = Search::InvertedIndex::DB::Mysql->new( -db_name => $dbname, -username => $dbuser, -password => $dbpass, -hostname => '', -table_name => 'siindex', -lock_mode => 'EX' ); my $search = CGI::Wiki::Search::SII->new( indexdb => $indexdb );
Takes only one parameter, which is mandatory.
indexdb
must be aSearch::InvertedIndex::DB::*
object. - search_nodes
-
# Find all the nodes which contain the word 'expert'. my %results = $search->search_nodes('expert');
Returns a (possibly empty) hash whose keys are the node names and whose values are the scores in some kind of relevance-scoring system I haven't entirely come up with yet. For OR searches, this could initially be the number of terms that appear in the node, perhaps.
Defaults to AND searches (if $and_or is not supplied, or is anything other than
OR
oror
). - index_node
-
$search->index_node($node);
Indexes or reindexes the given node in the Search::InvertedIndex indexes.
- delete_node
-
$search->delete_node($node);
Removes the given node from the search indexes. NOTE: It's up to you to make sure the node is removed from the backend store. Croaks on error.
- supports_phrase_searches
-
if ( $search->supports_phrase_searches ) { return $search->search_nodes( '"fox in socks"' ); }
Returns true if this search backend supports phrase searching, and false otherwise.