MySQL Forums
Forum List  »  Full-Text Search

Re: How to convert text relevance value to percentage values (Calculate % in Query)
Posted by: News Heat Dot Com
Date: May 03, 2007 07:46AM

A way to Calculate the percentages on the fly is as follows:
SELECT
a.randomfield1
, MATCH(a.field1) AGAINST('search_text') as relevance
, b.maxrelevance
, (MATCH(a.field1) AGAINST('search_text'))/b.maxrelevance*100 as relevanceperc
FROM
table1 a
, (SELECT MAX(MATCH(field1) AGAINST('search_text')) as maxrelevance FROM table1 LIMIT 1) b
WHERE
MATCH(a.field1) AGAINST('search_text')
ORDER BY
relevance DESC;

This query was built on MySQL version 4.1.7



Edited 1 time(s). Last edit at 05/03/2007 08:04AM by News Heat Dot Com.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to convert text relevance value to percentage values (Calculate % in Query)
9820
May 03, 2007 07:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.