C'est une fonctionnalité qui est présente nativement sur la plupart des (bonnes) bases de données récentes.
Pour Mysql, c'est MATCH ... AGAINST (pas testé)
mysql> SELECT id, body, MATCH (title,body) AGAINST
-> ('Security implications of running MySQL as root') AS score
-> FROM articles WHERE MATCH (title,body) AGAINST
-> ('Security implications of running MySQL as root');
+----+-------------------------------------+-----------------+
| id | body | score |
+----+-------------------------------------+-----------------+
| 4 | 1. Never run mysqld as root. 2. ... | 1.5055546709332 |
| 6 | When configured properly, MySQL ... | 1.31140957288 |
+----+-------------------------------------+-----------------+
2 rows in set (0.00 sec)
# fonction MATCH ... AGAINST
Posté par clem . En réponse au message Pertinence reqete sql. Évalué à 3.
Pour Mysql, c'est MATCH ... AGAINST (pas testé)
Pour l'utilisation, voir la doc :
http://www.nexen.net/docs/mysql/annotee/fulltext-search.php(...)
Exemple de requête :
mysql> SELECT id, body, MATCH (title,body) AGAINST
-> ('Security implications of running MySQL as root') AS score
-> FROM articles WHERE MATCH (title,body) AGAINST
-> ('Security implications of running MySQL as root');
+----+-------------------------------------+-----------------+
| id | body | score |
+----+-------------------------------------+-----------------+
| 4 | 1. Never run mysqld as root. 2. ... | 1.5055546709332 |
| 6 | When configured properly, MySQL ... | 1.31140957288 |
+----+-------------------------------------+-----------------+
2 rows in set (0.00 sec)