Jump to content


This topic is now archived and is closed to further replies.


Need Search Engine tips - got any?

Recommended Posts

Hi all, I hope all is well,

I'm just beginning to write my site's advanced search engine. I've checked out the full-text search engine tutorial and it's great - no problem there. I can easily grasp how to write a basic search engine. However, my needs are a bit more complex.

For example: I have a table full of products. In this table I have ids for three external tables that will need to be included in the advanced search. I have an artists table, a media type table, and two category tables.
For the artist and media table, I can simply query the tables for the id and then include the id in my search of the product table.

Where I think I need help is with my categories. You see, I have a many to many table inbetween my products and my categories table. It get's tricky with my category table itself, because I have three levels of categories.
As an example, my category table kinda looks like this:

id | cat_name | level2_id | level3_id

So, If I was only searching for a top level category, with an id of 7, I could search the many-to-many products_categories table for all products that match id 7. (I guess I would have to join the many-to-many table with the products table? Not sure about this) - However, the above results would be limited because they wouldn't include any of the sub or sub-sub category ids! So, for a thorough search of all products in a top category, I might have to search for matches of 50 or more category ids! So I need to some how be able to tie in the search through the category tables and then the search through the many-to-many table and then finally combine that with the search of the products table itself. Did I lose you yet?

Can you see how I might be a little confused here? Any tips or suggestions to point me in the right direction?


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.