diff options
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r-- | classes/Memcached_DataObject.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index f8e1b9acc..e1d58dd70 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -169,4 +169,19 @@ class Memcached_DataObject extends DB_DataObject return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals)); } } + + function getSearchEngine($table) { + require_once INSTALLDIR.'/classes/SearchEngines.php'; + static $search_engine; + if (!isset($search_engine)) { + if (common_config('sphinx', 'enabled')) { + $search_engine = new SphinxSearch($this, $table); + } elseif ('mysql' === common_config('db', 'type')) { + $search_engine = new MySQLSearch($this, $table); + } else { + $search_engine = new PGSearch($this, $table); + } + } + return $search_engine; + } } |