sql - MySQL bool 全文搜索中的 "Show all except"

标签 sql mysql

使用 MySQL bool 全文搜索...

http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html

A leading minus sign indicates that this word must not be present in any of the rows that are returned.

Note: The - operator acts only to exclude rows that are otherwise matched by other search terms. Thus, a boolean-mode search that contains only terms preceded by - returns an empty result. It does not return “all rows except those containing any of the excluded terms.”

有什么方法可以搜索除包含任何排除项的行之外的所有行吗?

喜欢 (+* -blah -blah2)

最佳答案

不,但它等同于简单地 NOT 条件:

SELECT *
FROM foo
WHERE NOT MATCH (bar) AGAINST ('blah blah2')

当然这样的查询不可能真正使用全文索引进行快速查找。

关于sql - MySQL bool 全文搜索中的 "Show all except",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3913777/

相关文章:

mysql - 在 MS Access 中将时间戳转换为人类可读

SQL - 将时间序列事件转换为开/关对(处理可能丢失的开或关)

sql - 在 Excel 或 OpenOffice 中的公共(public)列上合并两个电子表格

c# - 如何使用纬度和经度计算距离?

mysql - 为什么我应该为 MySQL 中的 varchar 选择 255 以外的任何长度?

php - 产品表连接库存

MySql - TIME() 函数在 CASE 语句中不起作用

sql - 无法生成 SQL 查询

sql - 如何与多个 CTE 表进行 UNION?

mysql - Pphunit 不断给出错误 : [1049] Unknown database ':memory:'