PurpleWiki::Search::Interface - Base class for PurpleWiki search modules
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.
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.
Performs the search query for this module and returns the result as a list of PurpleWiki::Search::Results.
Provides access to the PurpleWiki::Config object being used for configuration information.
Chris Dent, <firstname.lastname@example.org>