NAME

CGI::Wiki::Search::DBIxFTS - DBIx::FullTextSearch search plugin for CGI::Wiki

REQUIRES

DBIx::FullTextSearch

SYNOPSIS

  my $store = CGI::Wiki::Store::MySQL->new(
                                    dbname => "wiki", dbpass=>"wiki" );
  my $search = CGI::Wiki::Search::DBIxFTS->new( dbh => $store->dbh );
  my %wombat_nodes = $search->search_nodes("wombat");

Provides search-related methods for CGI::Wiki

METHODS

new
  my $search = CGI::Wiki::Search::DBIxFTS->new( dbh => $dbh );

You must supply a handle to a database that has the DBIx::FullTextSearch indexes already set up. (Currently though there's no checking that what you supply is even a database handle at all, let alone one that is compatible with DBIx::FullTextSearch.)

search_nodes
  # Find all the nodes which contain both the word 'expert' and the
  # phrase 'wombat defenestration'.
  %results = $search->search_nodes('expert "wombat defenestration"');

  # Find all the nodes which contain at least one of the words
  # 'buffy', 'pony', and 'pie'.
  %results = $search->search_nodes('buffy pony pie', 'OR');

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 or or).

Searches are case-insensitive.

index_node
  $search->index_node($node);

Indexes or reindexes the given node in the FTS indexes in the backend storage.

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, returns true on success.

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.

SEE ALSO

CGI::Wiki