在全文索引php中正确排序显示

时间:2014-04-16 09:57:35

标签: php html mysql

以下是我的询问: -

SELECT 
  author,
  (
   (MATCH(author) AGAINST('Anna Selby' in BOOLEAN MODE) * 20) +
   (MATCH(title) AGAINST('Anna Selby' in BOOLEAN MODE) * 10) +
   (MATCH(series) AGAINST('Anna Selby' in BOOLEAN MODE) * 5)) as score
FROM 
  search 
WHERE 
  MATCH(author,title,series) AGAINST('Anna Selby' in BOOLEAN MODE)
ORDER BY
  score DESC

一切正常,但问题是每当我搜索作者名称'A selby'时,先显示'Anna Selby'的结果,然后显示结果为'A selby'。

有什么方法可以确保在'Anna Selby'之前显示'A Selby'结果。当我检查分数时,我发现两个'Anna Selby'的结果和'A Selby'的结果都有相同的分数。

1 个答案:

答案 0 :(得分:1)

尝试修改条件:

ORDER BY
  score DESC, author ASC;