Le seuil de 50% a un impact significatif lorsque vous commencez à comprendre comment fonctionne l'index : si vous créez une table et insérez une ou deux lignes, chaque mot apparaîtra dans 50% des lignes. Résultat, la recherche ne trouvera rien. Assurez-vous d'insérer au moins trois lignes, et même plus.
SELECT titreannonce,MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot') AS score FROM annonces WHERE MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
Vous pouvez également utiliser le mode booleen.Code : Tout sélectionner
Les résultat en recherche fulltext peuvent être trié par ordre de pertinence en rajoutant dans les champs sélectionnés les prédicat match et against :SELECT titreannonce,MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot') AS score FROM annonces WHERE MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
cela marche nikel par contre ma requete étant plus compliqué je n'arrive pas a voir comme l'adapter par rapport a la requete que tu m'a fourniSELECT
annonces.region ,
annonces.titreannonce ,
annonces.descriptionannonce ,
annonces.numannonce ,
annonces.prix ,
annonces.date ,
images.miniature,
images.id_img
FROM annonces
LEFT JOIN images
ON images.numannonce = annonces.numannonce
WHERE MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
ORDER BY DATE
je devrait supprimer je pense dans la requete le order by date.SELECT
annonces.region ,
annonces.titreannonce ,
annonces.descriptionannonce ,
annonces.numannonce ,
annonces.prix ,
annonces.date ,
images.miniature,
images.id_img
MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
FROM annonces
LEFT JOIN images
ON images.numannonce = annonces.numannonce
AS score FROM annonces WHERE MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
ORDER BY DATESELECT
annonces.region ,
annonces.titreannonce ,
annonces.descriptionannonce ,
annonces.numannonce ,
annonces.prix ,
annonces.date ,
images.miniature,
images.id_img,
MATCH (annonces.titreannonce,annonces.descriptionannonce) AGAINST ('$Mot') AS score
FROM annonces
LEFT JOIN images
ON images.numannonce = annonces.numannonce
WHERE MATCH (titreannonce,descriptionannonce) AGAINST ('$Mot')
ORDER BY score,date