Reputation: 2227
I am trying to run a match against query and it is not working. I created a full text index on the two fields. But am getting sql error right before word 'relationship". Here is sql:
"SELECT * FROM pages WHERE MATCH (shdescript,ldescript) AGAINST (romance, relationship)";
I have also tried just searching against shdescript and just searching against ldescript but get same error. Also I've tried searchstring without spaces. As far as I know, you are supposed to have the words of the searchstring separated by commas in parentheses. What am I doing wrong? Thanks.
Upvotes: 1
Views: 9243
Reputation: 5198
I believe your AGAINST
must be in quotes. From:
http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html#function_match
AGAINST takes a string to search for, and an optional modifier that indicates what type of search to perform. The search string must be a literal string, not a variable or a column name.
Upvotes: 0
Reputation: 6275
Try quoting your string (i.e 'romance' and 'relationship')
SELECT * FROM pages WHERE MATCH (shdescript,ldescript) AGAINST ('romance', 'relationship')
Upvotes: 1
Reputation: 76426
"SELECT * FROM pages WHERE MATCH (shdescript,ldescript) AGAINST ('romance', 'relationship')";
Also make sure you protect yourself against the nasty SQL injection threat, read more here.
Upvotes: 1