mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Replace Sphinx API to the composer version
This commit is contained in:
parent
2e092c7bd4
commit
fcc05aa677
4 changed files with 9 additions and 1711 deletions
|
@ -42,6 +42,7 @@
|
|||
},
|
||||
"require": {
|
||||
"php": "^5.3 || ^7.0",
|
||||
"gigablah/sphinxphp": "^2.0",
|
||||
"google/recaptcha": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2239,13 +2239,14 @@ function init_sphinx()
|
|||
global $sphinx;
|
||||
|
||||
if (!isset($sphinx)) {
|
||||
require(INC_DIR . 'api/sphinx.php');
|
||||
$sphinx = new SphinxClient();
|
||||
$sphinx = \Sphinx\SphinxClient::create();
|
||||
|
||||
$sphinx->SetConnectTimeout(5);
|
||||
$sphinx->SetRankingMode(SPH_RANK_NONE);
|
||||
$sphinx->SetMatchMode(SPH_MATCH_BOOLEAN);
|
||||
$sphinx->SetRankingMode($sphinx::SPH_RANK_NONE);
|
||||
$sphinx->SetMatchMode($sphinx::SPH_MATCH_BOOLEAN);
|
||||
}
|
||||
|
||||
return $sphinx;
|
||||
}
|
||||
|
||||
function log_sphinx_error($err_type, $err_msg, $query = '')
|
||||
|
@ -2271,7 +2272,7 @@ function get_title_match_topics($title_match_sql, $forum_ids = array())
|
|||
$title_match_sql = encode_text_match($title_match_sql);
|
||||
|
||||
if ($bb_cfg['search_engine_type'] == 'sphinx') {
|
||||
init_sphinx();
|
||||
$sphinx = init_sphinx();
|
||||
|
||||
$where = ($title_match) ? 'topics' : 'posts';
|
||||
|
||||
|
@ -2280,7 +2281,7 @@ function get_title_match_topics($title_match_sql, $forum_ids = array())
|
|||
$sphinx->SetFilter('forum_id', $forum_ids, false);
|
||||
}
|
||||
if (preg_match('#^"[^"]+"$#u', $title_match_sql)) {
|
||||
$sphinx->SetMatchMode(SPH_MATCH_PHRASE);
|
||||
$sphinx->SetMatchMode($sphinx::SPH_MATCH_PHRASE);
|
||||
}
|
||||
if ($result = $sphinx->Query($title_match_sql, $where, $userdata['username'] . ' (' . CLIENT_IP . ')')) {
|
||||
if (!empty($result['matches'])) {
|
||||
|
|
|
@ -29,7 +29,7 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
function get_sql_log()
|
||||
{
|
||||
global $DBS, $CACHES, $sphinx, $datastore;
|
||||
global $DBS, $CACHES, $datastore;
|
||||
|
||||
$log = '';
|
||||
|
||||
|
@ -45,8 +45,6 @@ function get_sql_log()
|
|||
}
|
||||
}
|
||||
|
||||
$log .= !empty($sphinx) ? get_sql_log_html($sphinx, '$sphinx') : '';
|
||||
|
||||
if (!empty($datastore->db->dbg)) {
|
||||
$log .= get_sql_log_html($datastore->db, 'cache: datastore [' . $datastore->engine . ']');
|
||||
} elseif (!empty($datastore->dbg)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue