RE: [PHP] search results return by relevancy
| From: | Brian Paulson | Date: | Thu, 19 Apr 2001 14:01:39 +0000 |
| Subject: | RE: [PHP] search results return by relevancy | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49368@lists.php.net to get a copy of this message | ||
You might try this article on devshed on how to create a search engine using
MySql and php.
http://www.devshed.com/Server_Side/PHP/Search_Engine/
I currently use this same Technique to run our classifieds at
http://www.chieftainclassifieds.com
Thank you
Brian Paulson
Sr. Web Developer
bpaulson@chieftain.com
http://www.chieftain.com
1-800-269-6397
-----Original Message-----
From: Jen Hall [mailto:jhall@conovertuttle.com]
Sent: Thursday, April 19, 2001 7:57 AM
To: php3 Mailing List
Subject: [PHP] search results return by relevancy
Hi there
I have some scripts that do a search in a MySQL database
table.
I want to be able to return rows that match a query, in
order of relevancy.
For example, say I have a table that has the following data
|row_id| data
|------|-------------------------------------
| 1 | cat
| 2 | cat cat
| 3 | cat cat cat
| 4 | cat cat
| 5 | cat cat cat cat cat cat cat
| 6 | cat
| 7 | cat cat cat cat
| 8 | cat cat cat cat cat
I want to do a search that would return row_id 5 first, then
row_id 8, then row_id 7, then 3, etc.
So I want to order the return by relevancy.
What should the sql query look like?
select * from table where data like '%cat%' order by ?????
thanks
-jen