gpt4 book ai didi

MySQL:在多列中搜索关键字

转载 作者:行者123 更新时间:2023-11-30 22:46:56 25 4
gpt4 key购买 nike

我想在 MySQL 表的两列中搜索一个或多个关键字。

我试过这个查询:

select * 
from table
where match(col1, col2) against ('keyword1 keyword 2' with query expansion)

但是这个查询并不总是给出正确的结果。有什么建议吗?

最佳答案

这可能有帮助:

select *, match(col1, col2) 
against ('keyword1 keyword2' in boolean mode) as relevance
from content
where match(col1, col2)
against ('keyword1 keyword2' in boolean mode)
order by relevance;

比较 results这个查询和你上面写的那个。

请注意,使用 WITH QUERY EXPANSION 会导致更模糊的搜索。来自 the documentation :

"It works by performing the search twice, where the search phrase for the second search is the original search phrase concatenated with the few most highly relevant documents from the first search."

关于MySQL:在多列中搜索关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29338985/

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