Monday, January 05, 2009

Weighted fulltext search in MySQL


SELECT
*,
(MATCH (column1) AGAINST ('$query' IN BOOLEAN MODE)*100) +
(MATCH (column2) AGAINST ('$query' IN BOOLEAN MODE)*10) +
MATCH (column3) AGAINST ('$query' IN BOOLEAN MODE) AS rating
FROM
table
WHERE
MATCH (column1,column2,column3) AGAINST ('$query' IN BOOLEAN MODE)
ORDER BY
rating DESC
LIMIT 0,10

2 comments:

Anonymous said...

Does уour blog have a contact page? I'm having a tough time locating it but, I'd liκe
to send you an еmaіl. I've got some recommendations for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it improve over time.

Here is my website :: bucket truck

Anonymous said...

Does your blog havе a contact ρаge? I'm having a tough time locating it but, I'd
like to send you an email. I've got some recommendations for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it improve over time.

Take a look at my web-site bucket truck
my site - bucket truck