Hey all. I am having an issue with the MATCH() AGAINST() query in MySQL. I'm not really new at MySQL or at Web Development. This is, however, the first time I have used "MATCH() AGAINST()" before. Let me set this up: Table: `sources` Rows used (in this example): 'title' - varchar(255) 'desc' - text Indexes: 'IdxText' - title, desc - FULLTEXT Row Values: 1 entry: title = "Hello World" desc = "this is a test" QUERY: $mysql = mysql_query("SELECT * FROM sources WHERE MATCH(`title`,`desc`) AGAINST('".$keywords."')") or die(mysql_error()); Or more obviously: SELECT * FROM sources WHERE MATCH(`title`,`desc`) AGAINST('".$keywords."') $keywords = inserted string from user Everything that is entered in for $keywords always returns nothing. If "Hello" is inserted, it returns 0 rows. I get no errors (even through myphpadmin). If I am seeing this right, it should return the row because it has "Hello World" in the `title` row and I am searching the `title` row (and the `desc`) row for 'Hello'.......no rows are returned. If you are wondering why i have the ` around 'title' and 'desc', it is because 'desc' will be interpreted as "descending" by MySQL and throw an error. If it changes anything, I am using MySQL 5.0.45. I have researched this for about half a day, non-stop. I pretty much turn to you guys as my last resort. Why is this returning no rows?
Could this function be similar to the LIKE function? If so then try putting % before and after each field you are trying to match the keyword against. e.g. (`%title%`,`%desc%`)
Nope, that doesn't work. Neither in the MATCH clause nor in the AGAINST clause Yes, it is MyIsam and the Collation is latin1_swedish_ci. Any other ideas?
If you have only one record then you should consider INSERTing more than 4 records. But keeping in mind 50% threshold.
From MySQL Manual I can not post links Try searching on google for MySQL FULLTEXT search and click on the first record.
Ah! I inserted 7 rows and typing "hello world" returns the 1 row that has it. However, just typing "hello" does not return anything (even though only 1 out of 7 rows has it). Thanks so much!
Run this query in MySQL and post back what it returns SHOW VARIABLES LIKE 'ft_min_word_len'; Code (markup):
Then it should return the result when querying only for hello. Check the stop word list by SHOW VARIABLES LIKE 'ft_stopword_file'; Code (markup): Read full page here dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html
The result of the stopword file just says "(built-in)". Maybe it is on the stopword list for my hosts' server?