简体   繁体   English

为什么MySQL对列匹配会返回否定结果?

[英]Why does MySQL match against columns return a negative result?

I just found the great benefit of MySQL match against but just stumbled upon trouble. 我刚刚发现MySQL 匹配具有很大的优势,但是偶然发现了麻烦。

If the joined table2 has no paired rows. 如果联接的table2没有成对的行。 MySQL match against returns a negative value for the paired/join column that has NULL as value. 与MySQL匹配时,对以NULL作为值的paired / join列返回负值。 Removing the column from the match group returns a positive value for relevance. 从匹配组中删除该列将为相关性返回一个正值。 Why would one NULL column cause the whole match to return -2? 为什么一个NULL列会导致整个匹配返回-2?

select *, match(t1.column1, t1.column2, t1.column3, t1.column4, t2.column5) against ('search string' in boolean mode) as relevance
from table1 t1
left join table2 t2 on (t2.id = t2.column_id)
/*having relevance > 0*/
order by relevance desc;

I guess. 我猜。

What if search texts contain operator '-' or '+'? 如果搜索文本包含运算符“-”或“ +”怎么办?

relevance can be negative just when you have operator '-' on your search text 仅当您在搜索文本中使用运算符“-”时,相关性才可能为负

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM