I’m trying to search my database table and get all records except those containing a specific word. When I use the minus operator alone, it doesn’t work as expected. The MySQL documentation explains that the minus operator only excludes rows that would otherwise match other search terms. If you only use terms with minus signs, you get no results at all instead of getting all rows except the excluded ones.
Right now I’m using a workaround where I add wildcard matches for every letter of the alphabet like “a* b* c* … x* y* z* -unwanted_term”. This forces other results to match first, then excludes what I don’t want.
Is there a better or more elegant solution for this type of exclusion search in MySQL fulltext?