[feature/sphinx-fulltext-search] minor changes

some minor code changes to make it working against current develop
and comply with other search backend coding convetions.

PHPBB3-10946
This commit is contained in:
Dhruv Goel 2012-05-09 19:13:36 +05:30 committed by Dhruv
parent a50b0faf4a
commit fcf0d04b20

View file

@ -18,33 +18,27 @@ if (!defined('IN_PHPBB'))
/** /**
* @ignore * @ignore
*/ */
/**
* This statement is necessary as this file is sometimes included from within a
* function and the variables used are in global space.
*/
global $phpbb_root_path, $phpEx, $table_prefix;
require($phpbb_root_path . "includes/sphinxapi-0.9.8." . $phpEx); require($phpbb_root_path . "includes/sphinxapi-0.9.8." . $phpEx);
define('INDEXER_NAME', 'indexer'); define('INDEXER_NAME', 'indexer');
define('SEARCHD_NAME', 'searchd'); define('SEARCHD_NAME', 'searchd');
define('SPHINX_TABLE', table_prefix() . 'sphinx'); define('SPHINX_TABLE', $table_prefix . 'sphinx');
define('MAX_MATCHES', 20000); define('MAX_MATCHES', 20000);
define('CONNECT_RETRIES', 3); define('CONNECT_RETRIES', 3);
define('CONNECT_WAIT_TIME', 300); define('CONNECT_WAIT_TIME', 300);
/**
* Returns the global table prefix
* This function is necessary as this file is sometimes included from within a
* function and table_prefix is in global space.
*/
function table_prefix()
{
global $table_prefix;
return $table_prefix;
}
/** /**
* fulltext_sphinx * fulltext_sphinx
* Fulltext search based on the sphinx search deamon * Fulltext search based on the sphinx search deamon
* @package search * @package search
*/ */
class fulltext_sphinx class phpbb_search_fulltext_sphinx
{ {
var $stats = array(); var $stats = array();
var $word_length = array(); var $word_length = array();
@ -53,7 +47,7 @@ class fulltext_sphinx
var $common_words = array(); var $common_words = array();
var $id; var $id;
function fulltext_sphinx(&$error) public function __construct(&$error)
{ {
global $config; global $config;
@ -82,6 +76,16 @@ class fulltext_sphinx
$error = false; $error = false;
} }
/**
* Returns the name of this search backend to be displayed to administrators
*
* @return string Name
*/
public function get_name()
{
return 'Sphinx Fulltext';
}
/** /**
* Checks permissions and paths, if everything is correct it generates the config file * Checks permissions and paths, if everything is correct it generates the config file