Page 1 of 1

Trouble with MATCH ... AGAINST in MYSQL

Posted: Mon Jun 23, 2008 6:50 am
by htdung
I have a table like this:

Code: Select all

CREATE TABLE `lt_producer` (
  `producerID` int(11) unsigned NOT NULL default '0',
  `producerName` varchar(50) default NULL,
  `producerLogo` varchar(100) default NULL,
  `module` text,
  `timeupdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`producerID`),
  KEY `producerID` (`producerID`),
  FULLTEXT KEY `FULLTEXT` (`module`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
I have input some records and run a query like following:

Code: Select all

select producerName,module from lt_producer where match(module) against ('abc*');
The result has no record even the table has two record with the words 'abc' in `module` field.
Who got that? Help me !

Re: Trouble with MATCH ... AGAINST in MYSQL

Posted: Mon Jun 23, 2008 9:51 am
by pickle
You're not looking for 'abc', you're looking for 'abc*'. Take out the asterix.

Also, put the match...against clause in the field list as well as the where clause - that'll sort your results by relevancy.