Creating Directory Search Engine
| From: | olinux | Date: | Fri, 08 Feb 2002 06:17:39 +0000 |
| Subject: | Creating Directory Search Engine | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16657@lists.php.net to get a copy of this message | ||
Hi All,
I am trying to build a search engine for a directory.
So far I have setup a table of keywords [ id |
category_id | keyword ] with a single keyword and the
category that it refers to. Then I have a table of
categories [ cat_id | parent_id | cat_name ] and a
table of vendors linked to the corresponding
category_id. Basically the trouble arises when
searching for multiple keywords because there is only
one word in each record. I am trying to do this in a
single query, but it seems that there must be a better
way.
For example
TABLE keywords [ id | category_id | keyword ]
ex. records
1 | 10 | auto
2 | 10 | car
3 | 10 | repair
4 | 20 | auto
5 | 20 | car
6 | 20 | new
7 | 20 | sales
These keywords refer to the categories 'auto repair'
(cat_id = 10) and 'new auto sales' (cat_id = 20)
So a search for 'auto' should return vendors in both
categories while a search for 'auto repair' should
return just category 10
Make sense? Please let me know of a good strategy for
this - I imagine that it is quite common.
Thanks much,
olinux
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com