Child classes:
SearchEngine_IndexServerInherited Variables
Inherited Methods
Class Details
This class is designed as a Search Engine abstraction.
Its goal is to offer a standard API for various indexers
such as mnoGoSearch, ht://dig, MS IndexServer, etc...
It uses XML streams to serve search results. Please refer
to the package documentation for more detailed information !
Each specific implementation must use some configuration technique
so that the behaviour of an indexer can be finely tuned !
Tags:
- Package - sevenseas
- Version - $Revision$
- Author - Antoine Angénieux <aangenieux@clever-age.com>
[ Top ]
Class Variables
$m_logEnabled = false
Tag that determines whether the instance should do any logging.
Tags:
- Access - private
Type: boolean
Overrides:
[ Top ]
$m_logger = NULL
Optionnal logger.
Can be used to refine an indexer parameters!
Tags:
- Access - private
Type: Log
Overrides:
[ Top ]
$m_resultBuilder =
ResultBuilder used to parse the XML result stream
and to build the SearchResult array
Tags:
- Access - private
Type: SearchResult
Overrides:
[ Top ]
Class Methods
disableLogging
void disableLogging ( )
This method disables logging.
Tags:
- Access - public
Parameters:
[ Top ]
enableLogging
mixed enableLogging ( )
This method enables logging.
It returns a PEAR::Error if the instance
internal logger has not been set
Tags:
- Return - void if logging is possible, PEAR::Error otherwise.
- Access - public
Parameters:
[ Top ]
factory
mixed &factory ( $engineType )
Attempts to return a valid implementation of the SearchEngine base class
based on the $engineType parameter.
Tags:
- Return - Either an instance of the desired specific SearchEngine subclass or PEAR::Error object
- Access - public
Parameters:
- String $engineType - : actually supported engine types are IndexServer (more to come soon ;))
[ Top ]
getResultBuilder
ResultBuilder &getResultBuilder ( )
This method returns the ResultBuilder used by this instance.
Tags:
- Access - public
Parameters:
[ Top ]
search
mixed &search ( $queryParams )
Computes the given query, and return the SearchResult array
Tags:
- Return - Instance of SearchResults or PEAR_Error
- Access - public
Parameters:
- Array $queryParams - containing the various params
[ Top ]
constructor SearchEngine
void constructor SearchEngine ( )
Base constructor.
a Log instance can be passed
Tags:
Parameters:
[ Top ]
setLogger
void setLogger ( &$logger )
This method sets the optionnal logger for this instance.
This method MUST be called prior to enableLogging.
Tags:
- Access - public
Parameters:
- Log &$logger - Logger
[ Top ]
setResultBuilder
mixed setResultBuilder ( &$resultBuilder )
This method sets the ResultBuilder used by this instance.
It return a PEAR::Error if the the ResultBuilder is not valid.
Tags:
- Return - void if ResultBuilder is valid, PEAR::Error otherwise.
- Access - public
Parameters:
- ResultBuilder &$resultBuilder - used to build search results
[ Top ]
_computeQuery
String &_computeQuery ( $queryParameters )
This is an abstract method that computes the query and return the XML
stream.
This method must me implemented for each specific index engine
Tags:
- Return - XML result stream
- Access - private
Overridden in child class(es) as: SearchEngine_IndexServer::_computeQuery()
Parameters:
- Array $queryParameters - query parameters
[ Top ]
_parseResultXMLStream
mixed &_parseResultXMLStream ( $inputStream )
This method parses an XML stream representing the search results
and generates the Array of SearchResult instances, keeping the
results in the same order as in the stream.
Tags:
- Return - Instance of SearchResults or PEAR_Error
- Access - private
Parameters:
- String $inputStream - representing the XML Stream to parse. This XML stream MUST validate the indexresults.xsd XML Schema!
[ Top ]
_searchLog
void _searchLog ( $message, [$priority = LOG_INFO] )
This methods is used to send information to the logger
or exits immediately if there is no logger attached
to this SearchEngine instance
Tags:
- Access - private
Parameters:
- String $message - represents the message to log
- int $priority - represents the message priority. Refer to PEAR Log class for the possible values
[ Top ]