0

Something strange is happening here with my SQL. I created an index called search with collums like: place_name, postal_code, admin_name1, admin_name2, admin_code1 But when I use the SQL command to search like:

SELECT * FROM `places` WHERE MATCH (`place_name`,`admin_name1`,`admin_name2`,`postal_code`) AGAINST ("Cambridge" IN BOOLEAN MODE);

It returns all Cambridge`s, thats fine. But when I run:

SELECT * FROM `places` WHERE MATCH (`place_name`,`admin_name1`,`admin_name2`,`postal_code`) AGAINST ("Cambridge, Massachusetts" IN BOOLEAN MODE);

Expecting it to return only Cambridges in Massachusetts. It returns all Cambridges (the first one in Iowa) and everything that has Massachusetts written somewhere.

Is there a way of fixing this?

1 Answer 1

1

I got it, the correct syntax would be:

SELECT * FROM `places` WHERE MATCH (`place_name`,`admin_name1`,`admin_name2`,`postal_code`) AGAINST (`+Cambridge +Massachusetts` IN BOOLEAN MODE);
1
  • how do you do the same with $_GEt??
    – Riham Nour
    Commented Dec 1, 2015 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .