diff options
Diffstat (limited to 'phpBB/includes/search/fulltext_sphinx.php')
-rw-r--r-- | phpBB/includes/search/fulltext_sphinx.php | 125 |
1 files changed, 115 insertions, 10 deletions
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index ad9854071d..5f5ff15b07 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -28,26 +28,101 @@ define('SPHINX_CONNECT_WAIT_TIME', 300); */ class phpbb_search_fulltext_sphinx { + /** + * Associative array holding index stats + * @var array + */ protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ protected $split_words = array(); + + /** + * Holds unique sphinx id + * @var string + */ protected $id; + + /** + * Stores the names of both main and delta sphinx indexes + * separated by a semicolon + * @var string + */ protected $indexes; + + /** + * Sphinx searchd client object + * @var SphinxClient + */ protected $sphinx; + + /** + * Relative path to board root + * @var string + */ protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ protected $php_ext; + + /** + * Auth object + * @var phpbb_auth + */ protected $auth; + + /** + * Config object + * @var phpbb_config + */ protected $config; + + /** + * DBAL object + * @var dbal + */ protected $db; + + /** + * Database Tools object + * @var phpbb_db_tools + */ protected $db_tools; + + /** + * Stores the database type if supported by sphinx + * @var string + */ protected $dbtype; + + /** + * User object + * @var phpbb_user + */ protected $user; + + /** + * Stores the generated content of the sphinx config file + * @var string + */ protected $config_file_data = ''; - public $search_query; - public $common_words = array(); + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; /** * Constructor - * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend. + * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false */ @@ -87,7 +162,7 @@ class phpbb_search_fulltext_sphinx $error = false; } - + /** * Returns the name of this search backend to be displayed to administrators * @@ -99,6 +174,36 @@ class phpbb_search_fulltext_sphinx } /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns false as there is no word_len array + * + * @return false + */ + public function get_word_length() + { + return false; + } + + /** + * Returns an empty array as there are no common_words + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return array(); + } + + /** * Checks permissions and paths, if everything is correct it generates the config file * * @return string|bool Language key of the error/incompatiblity encountered, or false if successful @@ -330,7 +435,7 @@ class phpbb_search_fulltext_sphinx } /** - * Performs a search on keywords depending on display specific params. You have to run split_keywords() first. + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first * * @param string $type contains either posts or topics depending on what should be searched for * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) @@ -759,23 +864,23 @@ class phpbb_search_fulltext_sphinx $tpl = ' <span class="error">' . $this->user->lang['FULLTEXT_SPHINX_CONFIGURE']. '</span> <dl> - <dt><label for="fulltext_sphinx_data_path">' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH_EXPLAIN'] . '</span></dt> + <dt><label for="fulltext_sphinx_data_path">' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH_EXPLAIN'] . '</span></dt> <dd><input id="fulltext_sphinx_data_path" type="text" size="40" maxlength="255" name="config[fulltext_sphinx_data_path]" value="' . $this->config['fulltext_sphinx_data_path'] . '" /></dd> </dl> <dl> - <dt><label for="fulltext_sphinx_host">' . $this->user->lang['FULLTEXT_SPHINX_HOST'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_HOST_EXPLAIN'] . '</span></dt> + <dt><label for="fulltext_sphinx_host">' . $this->user->lang['FULLTEXT_SPHINX_HOST'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_HOST_EXPLAIN'] . '</span></dt> <dd><input id="fulltext_sphinx_host" type="text" size="40" maxlength="255" name="config[fulltext_sphinx_host]" value="' . $this->config['fulltext_sphinx_host'] . '" /></dd> </dl> <dl> - <dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt> + <dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt> <dd><input id="fulltext_sphinx_port" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd> </dl> <dl> - <dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt> + <dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt> <dd><input id="fulltext_sphinx_indexer_mem_limit" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" />' . $this->user->lang['MIB'] . '</dd> </dl> <dl> - <dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt> + <dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt> <dd>' . (($this->config_generate()) ? '<textarea readonly="readonly" rows="6">' . $this->config_file_data . '</textarea>' : $this->config_file_data) . '</dd> <dl> '; |