Objectif : - Réaliser plusieurs recherches et renvoyer le meilleur résultat - Algorithme pour déterminer le meilleur résultat Utiliser les différents mode de recherche en supprimant des critères Utiliser les critères en mode texte ou en tant que filtre Utilisation de SphinxQL Syntaxe d'un select SELECT select_expr [, select_expr ...] FROM index [, index2 ...] [WHERE where_condition] [GROUP [N] BY {col_name | expr_alias} [, {col_name | expr_alias}]] [WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}] [HAVING having_condition] [ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]] [LIMIT [offset,] row_count] [OPTION opt_name = opt_value [, ...]] [FACET facet_options[ FACET facet_options][ ...]] SELECT * FROM test WHERE MATCH('@title hello @body world') OPTION ranker=bm25, max_matches=3000, field_weights=(title=10, body=3), agent_query_timeout=10000 OPTION field_weights index_weights max_matches ranker WHERE clause. This clause will map both to fulltext query and filters. Comparison operators (=, !=, <, >, <=, >=), IN, AND, NOT, and BETWEEN are all supported and map directly to filters. OR is not supported yet but will be in the future. MATCH('query') is supported and maps to fulltext query. Query will be interpreted according to full-text query language rules. There must be at most one MATCH() in the clause. Liste des opérateurs possible dans "select_expr" Retour du select Liste des éléments indexés hors fulltext mysql -h0 -P9306 SELECT *, WEIGHT() weight FROM ent, ent_phx WHERE MATCH('peugeot') ORDER BY rang DESC; mysql> SHOW META; +---------------+---------+ | Variable_name | Value | +---------------+---------+ | total | 1000 | | total_found | 2451 | | time | 0.022 | | keyword[0] | peugeot | | docs[0] | 2451 | | hits[0] | 3907 | +---------------+---------+ 6 rows in set (0.00 sec) Multi-statement queries SELECT follow by SHOW META SELECT * FROM myindex WHERE MATCH('@(title,content) find me fast'); http://sphinxsearch.com/docs/current.html#sphinxql-select http://demos.sphinxsearch.com/SphinxFacetingExample https://github.com/adriannuta/SphinxFacetingExample SELECT *, WEIGHT() weight FROM ent, ent_phx WHERE MATCH('peugeot') ORDER BY siege DESC, actif DESC, rang DESC FACET adr_dep FACET cj; 1. Requete 2. FACET sans paramètres 3. FACET