471,601 Members | 1,220 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

MySQL WHERE MATCH problem

Hi,

I have the following table

CREATE TABLE `fulltext_sample` (
`copy` text,
FULLTEXT KEY `copy` (`copy`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `fulltext_sample` VALUES ('This is a test to see how mysql
works');

Now I do a search for
SELECT * FROM fulltext_sample WHERE MATCH(copy) AGAINST('mysql');
and it return 0 results. Can someone please help me with this?

Thanks
Maz.
Jul 17 '05 #1
2 1700
Maziar,
I have the following table

CREATE TABLE `fulltext_sample` (
`copy` text,
FULLTEXT KEY `copy` (`copy`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


First you should always use an id field now...

If you look at the mysql manual for fulltext
(http://dev.mysql.com/doc/mysql/en/fulltext-search.html) the correct
way to create the table would be:
CREATE TABLE fulltext_sample (
id id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
copy TEXT,
FULLTEXT (copy)
);

What you pretty much did wrong at the top was trying to create a key. I
do not know exactly how mysql parses that but you may want to try over
with an ID column and the column for a copy.

Mike
Jul 17 '05 #2
Maziar,
What you pretty much did wrong at the top was trying to create a key. I
do not know exactly how mysql parses that but you may want to try over
with an ID column and the column for a copy.


Also one more quick note. From the manual:
" The search result is empty because the word ``MySQL'' is present in at
least 50% of the rows. As such, it is effectively treated as a stopword.
For large datasets, this is the most desirable behavior---a natural
language query should not return every second row from a 1GB table. For
small datasets, it may be less desirable."

Mike
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by renster | last post: by
reply views Thread by Phil Powell | last post: by
4 posts views Thread by Hal Halloway | last post: by
reply views Thread by Lenz Grimmer | last post: by
reply views Thread by Henry Hank | last post: by
reply views Thread by Phil Powell | last post: by
175 posts views Thread by Sai Hertz And Control Systems | last post: by
4 posts views Thread by Vanessa | last post: by
5 posts views Thread by Jagadish Kumar, Maripi | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.