| PurpleWiki documentation | view source | Contained in the PurpleWiki distribution. |
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.
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:
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, <cdent@blueoxen.org>
| PurpleWiki documentation | view source | Contained in the PurpleWiki distribution. |