0

When using Mariadb's FTS (full-text search), the following logic is pretty amusing:

SELECT id, first_name, last_name FROM user 
WHERE MATCH (first_name, last_name) AGAINST ('-veli' IN BOOLEAN MODE);
Empty set (0.001 sec)

SELECT id, first_name, last_name FROM user 
WHERE MATCH (first_name, last_name) AGAINST ('lauri -veli' IN BOOLEAN MODE);
+----------+------------+-----------+
| id       | first_name | last_name |
+----------+------------+-----------+
| 15804835 | Lauri      | Ylikangas |
+----------+------------+-----------+
1 row in set (0.001 sec)

This oddity is "ok", but then how to add "universal set" so the result would match the following?

SELECT id, first_name, last_name FROM user
WHERE NOT MATCH (first_name, last_name) AGAINST ('-veli' IN BOOLEAN MODE);
...
213 rows in set (0.002 sec)
Roman Susi
  • 4,135
  • 2
  • 32
  • 47

0 Answers0