I need to query the table for "all but keyword". Using just "-" doesn't work, and in fact mysql manual says:
我需要在表中查询“all but keyword”。仅使用“ - ”不起作用,实际上mysql手册说:
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.”
注意: - 运算符仅用于排除其他搜索项以其他方式匹配的行。因此,布尔模式搜索仅包含以 - 开头的术语 - 返回空结果。它不会返回“除包含任何排除项的行之外的所有行。”
The only workaround I found was "a* b* .... y* z* -keyword", as this allows all other results to match. Is there any other (cleaner) way?
我找到的唯一解决方法是“a * b * .... y * z * -keyword”,因为这允许所有其他结果匹配。还有其他(更清洁)的方式吗?
1 个解决方案
#1
1
Just use:
NOT MATCH(field) AGAINST(keyword)
#1
1
Just use:
NOT MATCH(field) AGAINST(keyword)