Tutorial :MATCH() AGAINST() & Fulltext index: Possible to have “keywords” field?



Question:

I'm using MATCH() AGAINST() with a fulltext index and I was wondering how I could setup a "keywords" data field.

So let's say I have a a fulltext index on the "title" column, which for example might have a row with the value of "AC/DC".. I want to have a field to enter additional keywords like "ACDC" "AC DC" and "AC-DC"

Ideally I'd like to specify these keywords in comma-delimited text form, like this:

Title: "AC/DC"  Keywords: "ACDC, AC DC, AC-DC"  

Any idea how I might accomplish this from a database perspective?

Let me know if you need any clarification!

Dave


Solution:1

Please - no comma separated values. Store the keyword info in a separate table:

DROP TABLE IF EXISTS `example`.`keywords`;  CREATE TABLE  `example`.`keywords` (    `title` varchar(45) NOT NULL,    `keyword` varchar(100) NOT NULL,    UNIQUE KEY `uk_idx` (`title`,`keyword`) USING BTREE  ) ENGINE=MyISAM DEFAULT CHARSET=latin1;  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »