与排名/相关性列匹配时,按顺序返回0

时间:2017-06-23 11:25:37

标签: mysql

当我在下面运行查询时,得分列始终为0:

SELECT
    *,
    (
        (MATCH (search.primary) AGAINST ('"test"' IN BOOLEAN MODE) * 5) +
        (MATCH (search.secondary) AGAINST ('"test"' IN BOOLEAN MODE) * 2.5) +
        (MATCH (search.tertiary) AGAINST ('"test"' IN BOOLEAN MODE) * 1)
    )
    AS score 
FROM
    publications 
    LEFT JOIN
        themes 
        ON themeUUID = publicationTheme 
    LEFT JOIN
        search 
        ON search.item_id = publications.publicationUUID
AND search.item_type = 'publication' 
WHERE
    publicationStatus = 'Live'
GROUP BY
    publicationUUID 
HAVING
    score <> 0
ORDER BY 
    score ASC

然而,当我没有按分数订购时,它会返回正确计算的分数。

我正在使用MySQL版本5.6.22,这个查询在我使用MySQL版本5.7.18的开发服务器上运行正常。

任何想法为什么得分列在订购时总是为0?提前谢谢。

0 个答案:

没有答案