Hello,

I am trying to structure query to execute MySQL fulltext search. I have creates simple table as follows:

CREATE TABLE IF NOT EXISTS `entries` (
`id` int(3) NOT NULL auto_increment,
`doc` text collate utf8_unicode_ci,
PRIMARY KEY (`id`),
FULLTEXT KEY `doc` (`doc`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

And dropped a few entries into it as follows:

INSERT INTO `entries` (`id`, `doc`) VALUES
(1, 'I like hunting'),
(2, 'Hunting is fun'),
(3, 'I like to eat meat');

Now, I am attempting to execute fulltext search according to the following query:

SELECT *
FROM entries
WHERE MATCH (
doc
)
AGAINST (
'hunting'
);

This returns 0 results. Why? I should think it would return two, no? I have also tried setting 'doc' field as varchar, this also does not help.

Thanks for any help you can provide.

MySQL returns empty result set if the search term is present in at least 50% of the rows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.