好的,所以我有两个查询,我正在测试,他们产生完全相同的结果,这就是说,以某种方式排序的相关性似乎不工作在这里:
$query1 = "SELECT * FROM ads
WHERE
MATCH (title,description) AGAINST ('+".$query."' IN BOOLEAN MODE)
AND status='Active'";
$query2 = "SELECT *,
MATCH (title, description) AGAINST ('+".$query."' IN BOOLEAN MODE)
AS score
FROM ads
WHERE status='Active' AND
MATCH(title, description) AGAINST ('+".$query."' IN BOOLEAN MODE)
ORDER BY score desc";
还要确保指定了返回结果的顺序。
ORDER BY desc, score DESC;