按相关性的布尔全文搜索顺序似乎不起作用

时间:2014-07-18 14:12:50

标签: php mysql search boolean relevance

好的,所以我有两个我正在测试的查询,并且它们会产生完全相同的结果,这就是说通过相关性进行排序似乎在这里不起作用:

$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";

1 个答案:

答案 0 :(得分:0)

另外,请确保指定要返回结果的顺序。

ORDER BY desc, score DESC;