好的,所以我有两个我正在测试的查询,并且它们会产生完全相同的结果,这就是说通过相关性进行排序似乎在这里不起作用:
$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";
答案 0 :(得分:0)
另外,请确保指定要返回结果的顺序。
ORDER BY desc, score DESC;