Problem is, relevance can be anything. It could be 3.6 for example, and multiplying that with a 100 will give me a number > 100. The way I had done it was to divide all results with the highest value of relevance and get something that was a percentage. But, if you do that, then if you have for example a search for the term:
'Another' and the best match is 'Another book about Perl', then this match is displayed as 100%. Which obviously, doesn't look right as it is considerably off the real relevance. ----- Original Message ----- From: "Gurhan Ozen" <[EMAIL PROTECTED]> To: "Mouratidis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 9:33 PM Subject: RE: Results relevance > Hi, > You can take 1.00 as baseline for 100%. Just multiply the relevance number > by 100.. For the relevance that are greater than 1.00 you will have a > number greater than zero and for everything else it will be smaller than or > equal to 100. > In your code, do something accomplish: > > if relevance is > 100 then > print <td width="100%" bgcolor="..."> > > else > print <td width=$rel% bgcolor="...."> > > This way you will have the percentage of the table colored with a > different background color.. > > Worth for noting, fulltext search returns no results if the search string is > in more than half of the rows. If you are coding for a library system and > especially when there are searches for a common keyword based on a specific > category, you might want to take this fact into consideration. > Sincerely, > Gurhan > > > -----Original Message----- > From: Mouratidis [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 3:45 PM > To: [EMAIL PROTECTED] > Subject: Re: Results relevance > > > Actually, that is exactly what I wanted to do! A bar graph for showing the > relevance between the term I am searching for and the results I get from > Mysql for a library system. I just don't know how to draw the bar (which is > going to be a table cell in a table) if I cannot have something to compare > it's value with. > I mean, it is easy to dynamically draw a bar with Perl using HTML, but, what > is the 100% ? > > > > ----- Original Message ----- > From: "Jim Philips" <[EMAIL PROTECTED]> > To: "Paul DuBois Mouratidis" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Monday, April 29, 2002 8:15 PM > Subject: Re: Results relevance > > > If the final goal of this is a visual display, maybe it would make more > sense > to display relevance as a horizontal bar graph that is longer or shorter > based on the relevance number. There is no reason to get hung up on > percentages. > > On Monday 29 April 2002 02:21 pm, Paul DuBois wrote: > > At 17:50 +0100 4/29/02, Mouratidis wrote: > > >Doing that will not give back a percentage or anything that can be used > to > > >calculate one (right?). I meant if there was a way to actually get a > > > result that could be interpreted into a percentage somehow. > > > > No. The values returned by a FULLTEXT search are simply non-negative > > floating-point numbers. The larger the number within a result set, > > the higher the relevance, but that doesn't map onto percentage. > > > > >----- Original Message ----- > > > > From: "Gurhan Ozen" <[EMAIL PROTECTED]> > > > > >To: "Mouratidis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > >Sent: Monday, April 29, 2002 3:58 PM > > >Subject: RE: Results relevance > > > > > >> Hi, > > >> You can just do > > >> SELECT MATCH(column name) AGAINST ('searchstring') AS relevance FROM > > >> tablename; > > >> > > >> There is an example at: > > >> http://www.mysql.com/doc/F/u/Fulltext_Search.html > > >> > > >> Gurhan > > >> > > >> -----Original Message----- > > >> From: Mouratidis [mailto:[EMAIL PROTECTED]] > > >> Sent: Monday, April 29, 2002 6:38 AM > > >> To: [EMAIL PROTECTED] > > >> Subject: Results relevance > > >> > > >> > > >> Anybody knows how to get a percentage out of the Relevance Mysql > > >> returns when queried with the match() function? > > >> I am using Perl, so if there are any scripts or modules that you know > > >> of, those are also welcome. > > >> > > > > Alex > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > > <[EMAIL PROTECTED]> Trouble > > unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php