What is the possible ways to control search engine reverence in MySQL? let us assume we are building a search engine for a small web store where buyers can add there stuff for sell. The table is:
CREATE TABLE `products` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 100 ) NOT NULL ,
`date` DATE NOT NULL ,
`buyer_level` INT( 2 ) NOT NULL ,
FULLTEXT (
`title`
)
) ENGINE = MYISAM ;
I want to give a weight for the following factors:
- title : Matching the input search keyword with the title,weight = 10.
- Buyer_level : higher is better. the level for the golden buyer is 10,bad buyers is 1. weight =5.
- Date : newer is better. weight =5.
The question is,how do we make MySQL output the result based on the value of the weight?
Example:
if we have the following rows in the table:
1, IPhone, 22-5-2010,9
2, IPhone, 22-5-2010,1
if the user search about Iphone, the first row should comes first and the second row should becomes the last because the first one have more wight than the second one.