Amélioration de la gestion des versions d'API sphinx

This commit is contained in:
Michael RICOIS 2012-04-24 13:02:22 +00:00
parent aa89b89606
commit 2bc76f7786

View File

@ -8,16 +8,6 @@ if (defined('DEBUG') == false) {
define( 'DEBUG', 0);
}
$version = defined('SPHINX_ENT_VERSION') ? SPHINX_ENT_VERSION : 1;
switch ( $version ) {
case 1:
require_once realpath(dirname(__FILE__)).'/sphinxapi.php';
break;
case 2:
require_once 'sphinxapi/sphinxapi-2.0.2.php';
break;
}
require_once realpath(dirname(__FILE__)).'/criteresFonc.php';
$gDatabaseJO = databaseJO();
@ -600,27 +590,41 @@ function clientSphinx(&$formR)
}
}
// Client Sphinx
$sphinx = new SphinxClient();
switch($formR['type'])
{
case 'ent':
$host = SPHINX_ENT_HOST;
$port = SPHINX_ENT_PORT;
$version = defined('SPHINX_ENT_VERSION') ? SPHINX_ENT_VERSION : 1;
break;
case 'dir':
$version = defined('SPHINX_DIR_VERSION') ? SPHINX_DIR_VERSION : 1;
$host = SPHINX_DIR_HOST;
$port = SPHINX_DIR_PORT;
break;
case 'histo':
$version = defined('SPHINX_HISTO_VERSION') ? SPHINX_HISTO_VERSION : 1;
$host = SPHINX_HISTO_HOST;
$port = SPHINX_HISTO_PORT;
break;
case 'act':
case 'act':
$version = defined('SPHINX_ACT_VERSION') ? SPHINX_ACT_VERSION : 1;
$host = SPHINX_ACT_HOST;
$port = SPHINX_ACT_PORT;
break;
}
switch ( $version ) {
case 1:
require_once realpath(dirname(__FILE__)).'/sphinxapi.php';
break;
case 2:
require_once 'sphinxapi/sphinxapi-2.0.2.php';
break;
}
// Client Sphinx
$sphinx = new SphinxClient();
$sphinx->SetServer($host, $port);
$sphinx->SetConnectTimeout(1);
$sphinx->SetRankingMode(SPH_RANK_PROXIMITY_BM25);