Searching a substring or word in MariaDB

Viewed 1597

I try to do full-text search on MariaDB and I encountered a problem that I cannot handle.

my table is generated as;

CREATE TABLE test (email TEXT, FULLTEXT(email)) ENGINE=InnoDB;

then insert some data;

MariaDB [frauctive]> select * from test;
+---------------------------------+
| email                           |
+---------------------------------+
| david@hotmail.com               |
| michael@gmail.com               |
| christian@gmail.com             |
| david01@hotmail.com             |
| davidblatt@hotmail.com          |
| beckhamdavidbeckham@hotmail.com |
+---------------------------------+

when I use match against function, I cannot retrieve the similarity score that I want to obtain;

MariaDB [frauctive]> SELECT email, MATCH(email) AGAINST('*david*' IN         BOOLEAN MODE) AS relevance 
->   FROM test ORDER BY relevance DESC;
+---------------------------------+--------------------+
| email                           | relevance          |
+---------------------------------+--------------------+
| david@hotmail.com               | 0.0906190574169159 |
| david01@hotmail.com             | 0.0906190574169159 |
| davidblatt@hotmail.com          | 0.0906190574169159 |
| michael@gmail.com               |                  0 |
| christian@gmail.com             |                  0 |
| beckhamdavidbeckham@hotmail.com |                  0 |
+---------------------------------+--------------------+

Altough "beckhamdavidbeckham@hotmail.com" entry contains 'david' pattern, score returns 0.

Can you please help me to fix this relevance?

1 Answers
Related