"Show all except" in MySQL Boolean Full-Text Searches
With MySQL Boolean Full-Text Searches...
http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html
A leading minus sign indi开发者_运维百科cates 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.”
Is there any way to do a search giving all rows except those that contain any of the excluded terms?
like (+* -blah -blah2)
No, but it would be equivalent to simply NOT
the condition:
SELECT *
FROM foo
WHERE NOT MATCH (bar) AGAINST ('blah blah2')
of course such a query can't possibly actually use the fulltext index for quick lookup.
精彩评论