note 5152 deleted from MySQL functions by danbeck
| From: | danbeck@php.net | Date: | Thu, 07 Sep 2000 14:30:40 +0000 |
| Subject: | note 5152 deleted from MySQL functions by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4334@lists.php.net to get a copy of this message | ||
zoubidoo@hotmail.com said:
<BR>SEARCH RANKING: I'd like to search a table for a few keywords and rank the results,
perhaps giving each a score. Is there a clever way of doing this?
<P>Reply:
<BR>Don't know about a "smart" way but my way to rank is to use something like:
<BLOCKQUOTE>SELECT id,count(*) AS foo FROM table_name WHERE word LIKE "search1%" OR
word LIKE "search2%" GROUP BY table_name.id ORDER BY foo DESC</BLOCKQUOTE>
I then base the relevancy on foo (i.e. current foo/first roo * 100). Not amazing but good enough
for government work. =) And no, I do not work for the government).