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
TABLE keywords [ id | category_id | keyword ]
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.
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php