12,6 → 12,8 |
see also: http://www.ibm.com/developerworks/library/os-sphinx/ |
see also: http://sphinxsearch.com/docs/manual-2.0.7.html#extended-syntax |
TODO: http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/ |
TODO: attention, projet,bazaar,spip et papyrus sont latin9, ainsi en est-il de l'input attendu du <form> |
mais pour coste... c'est full utf-8 |
*/ |
|
/* returned struct: |
25,6 → 27,8 |
'description' => '' |
*/ |
|
define('SPHINX_DSN', '127.0.0.1:9306'); |
|
// pour strftime() |
date_default_timezone_set('Europe/Paris'); |
setlocale(LC_TIME, 'fr_FR'); |
172,7 → 176,7 |
function sphinx_search($q = NULL, $page = 1) { |
if(!$q) return array(); |
|
$db = mysql_connect('127.0.0.1:9306', NULL, NULL, TRUE); |
$db = mysql_connect(SPHINX_DSN, NULL, NULL, TRUE); |
$req = mysql_query(sprintf("SELECT group_id, main_id FROM i_projet, i_spip, i_papyrus, i_bazar WHERE MATCH('%s') LIMIT 50", $q), $db); |
|
$res = array('spip' => array(), 'bazar' => array(), 'projet' => array(), 'papyrus' => array()); |