Subversion Repositories Applications.papyrus

Rev

Rev 2110 | Rev 2117 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2110 Rev 2113
Line 10... Line 10...
10
  sudo pecl install sphinx
10
  sudo pecl install sphinx
Line 11... Line 11...
11
 
11
 
12
  see also: http://www.ibm.com/developerworks/library/os-sphinx/
12
  see also: http://www.ibm.com/developerworks/library/os-sphinx/
13
  see also: http://sphinxsearch.com/docs/manual-2.0.7.html#extended-syntax
13
  see also: http://sphinxsearch.com/docs/manual-2.0.7.html#extended-syntax
-
 
14
  TODO: http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/
-
 
15
  TODO: attention, projet,bazaar,spip et papyrus sont latin9, ainsi en est-il de l'input attendu du <form>
14
  TODO: http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/
16
  		mais pour coste... c'est full utf-8
Line 15... Line 17...
15
*/
17
*/
16
 
18
 
17
/* returned struct:
19
/* returned struct:
Line 23... Line 25...
23
'title' => '', // balise 'title'
25
'title' => '', // balise 'title'
24
'date_creation' => '',
26
'date_creation' => '',
25
'description' => ''
27
'description' => ''
26
*/
28
*/
Line -... Line 29...
-
 
29
 
-
 
30
define('SPHINX_DSN', '127.0.0.1:9306');
27
 
31
 
28
// pour strftime()
32
// pour strftime()
29
date_default_timezone_set('Europe/Paris');
33
date_default_timezone_set('Europe/Paris');
Line 30... Line 34...
30
setlocale(LC_TIME, 'fr_FR');
34
setlocale(LC_TIME, 'fr_FR');
Line 170... Line 174...
170
}
174
}
Line 171... Line 175...
171
 
175
 
172
function sphinx_search($q = NULL, $page = 1) {
176
function sphinx_search($q = NULL, $page = 1) {
Line 173... Line 177...
173
	if(!$q) return array();
177
	if(!$q) return array();
174
 
178
 
Line 175... Line 179...
175
	$db = mysql_connect('127.0.0.1:9306', NULL, NULL, TRUE);
179
	$db = mysql_connect(SPHINX_DSN, NULL, NULL, TRUE);
176
	$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);
180
	$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);
177
 
181