问题描述
我试图建立利用布尔模式下全文检索搜索时变得有点混乱。下面是我使用的查询:
I'm getting a bit confused when trying to set up a search utilizing fulltext search in boolean mode. Here is the query I'm using:
$query = "SELECT *,
MATCH(title) AGAINST('$q' IN BOOLEAN MODE) AS score
FROM results
WHERE MATCH(title) AGAINST('$q' IN BOOLEAN MODE)
ORDER BY score DESC";
当我运行 +离婚+再融资
,返回的结果是一个搜索:
When I run a search for +divorce+refinance
, the results returned are:
1) Divorce: Paying Off Spouse = Rate/Term Refinance
2) Divorce - What to Look Out For Regarding Divorced Borrowers
我是正确的思维,第二个结果,不应该出现,因为它不具备这两个词?如果没有,我怎么可以创建功能?
Am I right in thinking that the second result should not be appearing, as it does not have both words? If not, how can I create that functionality?
推荐答案
也许我错了,但如果你搜索这个字符串 +离婚+再融资
你得到一个奇怪的结果。如果你想搜索的两个的话,你应该寻找 +离婚+再融资
(带之间有一个空格)。
Maybe I am mistaken, but if you search this string +divorce+refinance
you get a weird result. If you want to search both words, your should search for +divorce +refinance
(with a space between).
我测试,它仅返回一行:
I tested it and it returns only one row:
Divorce: Paying Off Spouse = Rate/Term Refinance
这篇关于MySQL的全文检索布尔模式的困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!