MySql match against in boolean mode

79 Views Asked by At

I have a query where I am trying to find a phone number from a table via partial phone number, so basically a search function where the user inserts a partial phone number and I need to find a match via that number.

I know I can use LIKE but I am trying to avoid that and I'd rather use Match against

Let's assume this is the phone number we are trying to find (111) 111-1111

SELECT * FROM contactinfo WHERE MATCH (contact_value) AGAINST ('"1111"' IN BOOLEAN MODE) AND contact_type = 'PHONE'

This query works as intended and I get the required match.

The issue appears when I am trying the following query

SELECT * FROM contactinfo WHERE MATCH (contact_value) AGAINST ('"(111)"' IN BOOLEAN MODE) AND contact_type = 'PHONE'

For some reason this does not return a match and I can not figure out why

When I try

SELECT * FROM contactinfo WHERE MATCH (contact_value) AGAINST ('+111*' IN BOOLEAN MODE) AND contact_type = 'PHONE'

It works but '"111"' does not

So my question is: How can I use match against in the mentioned scenario? Is there a min chr limit for match against?

0

There are 0 best solutions below