Search.php
456 Bytes
<?php
class Q_Search
{
static private $driver = array(
'sphinx', 'solr', 'auto'
);
static function factory($driver = 'solr', array $params = array('section' => 'servers'))
{
if (in_array(ucfirst($driver), self::$driver, true)) {
throw new Q_Exception($driver . ' Not In Search Driver List');
}
$className = 'Q_Search_Adapter_' . ucfirst($driver);
return new $className($params);
}
}