After reading quite a few online articles about using fulltext indexes in
MySQL, I'm still a little confused about the best solution for my simple
search script. I want to allow users to search for news articles. Here's the
table structure:

CREATE TABLE `news` (
  `id` int(7) unsigned NOT NULL auto_increment,
  `author` varchar(50) NOT NULL default '',
  `headline` varchar(60) NOT NULL default '',
  `content` text NOT NULL,
  `url` text NOT NULL,
  UNIQUE KEY `id` (`id`),
) TYPE=MyISAM;

I want searches for News to be on the author, headline and content fields.
What is the best way to index and search this?

A) Create a combined fulltext index: FULLTEXT (author,headline,content) --
and do searches using MATCH() and AGAINST()?

B) Create a fulltext index only on the content field and use this kind of
select: SELECT * FROM db WHERE author LIKE "%phrase%" OR headline LIKE
"%phrase%" OR MATCH(content) AGAINST(phrase);  ?

C) None of the above ... is there a better way?

I have MySQL 3.23.58 installed on my server. I thought the combo of fulltext
with the LIKE statements might be a good way to go because fulltext has a
3-char minimum and doesn't facilitate partial word matches. I don't mind
that for large text fields, but, not for things like headlines or authors.

Thanks a lot for any input or feedback!

T.





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to