gpt4 book ai didi

php - 按相关性进行 boolean 全文搜索顺序似乎不起作用

转载 作者:行者123 更新时间:2023-11-30 00:03:23 25 4
gpt4 key购买 nike

好的,我正在测试两个查询,它们产生完全相同的结果,这说明按相关性排序在这里似乎不起作用:

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

关于php - 按相关性进行 boolean 全文搜索顺序似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24827099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com