NAME
PurpleWiki::Search::Interface - Base class for PurpleWiki search modules
SYNOPSIS
Provides a base class for PurpleWiki pluggable search modules. All search modules should use this class and provide a search functionality by overriding the search() method.
DESCRIPTION
Modular searching is provided to PurpleWiki through the interaction of subclasses of PurpleWiki::Search::Interface with PurpleWiki::Search::Engine and PurpleWiki::Search::Result.
To add a new search module a class much be created that:
- Uses PurpleWiki::Search::Interface as its base class.
- Overrides the search() method to search for results in a particular domain.
- Stores those results in a list of PurpleWiki::Search::Result objects.
The list of PurpleWiki::Search::Result objects is returned from the search() method. Any configuration, such as locating file collections, should be done at the start of this method.
Access to the current PurpleWiki::Config object is available as it is passed to the Interface subclass by PurpleWiki::Search::Engine when a new object is created. Here is an example of how it is used:
my $configFile = $self->config()->ArtsDirectory() . 'arts.pl';
A search() method may do whatever it likes to get search results: open files, read databases, query the internet, etc. Time consuming operations should be avoided as results are generated and presented serially.
If a preferred ordering in the results is desired, this should be done in the module before the list of PurpleWiki::Search::Result objects is returned. The normal ordering is reverse chronological.
METHODS
- new()
- search($query)
-
Performs the search query for this module and returns the result as a list of PurpleWiki::Search::Results.
- config()
-
Provides access to the PurpleWiki::Config object being used for configuration information.
AUTHOR
Chris Dent, <cdent@blueoxen.org>