I'm doing a MySQL FULLTEXT search in boolean mode. According to the manual :
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.”
That's true.
So I use the NOT MATCH operator like this :
SELECT COUNT(*) FROM Table WHERE MATCH (Column) AGAINST
('bar' IN BOOLEAN MODE) AND NOT MATCH (Column) AGAINST
('barbar' IN BOOLEAN MODE);
My question is: what is the effect of the + operator in the NOT MATCH field: is
AND NOT MATCH (Column) AGAINST ('foo bar' IN BOOLEAN MODE)
the same as :
AND NOT MATCH (Column) AGAINST ('+foo +bar' IN BOOLEAN MODE)
Thanks
+
operator signifies that the search literal is present. Per MySQL DocumentationFor example, below query will retrieves all the rows that contain the word
MySQL
but that do not contain the wordYourSQL
EDIT:
WHERE NOT MATCH (column) AGAINST ('+foo +bar' IN BOOLEAN MODE)
should mean get me all the rows where values of column isn'tfoo
andbar
. it should be anegation
ofWHERE MATCH (column) AGAINST ('+foo +bar' IN BOOLEAN MODE)
Yes, both are not same.
Says that get all rows where values of column are foo and bar
Says that get all rows where values of column are foo or bar
Check the documentation carefully. It says