Design question - Selection Filters

Hello all-

I am implementing a database of items that link to vendors,
manufacturers, categories, and so on. Since there could be thousands of
components within the database, I am now starting the task of building
up the logic for selection filters.

I think I would like to store the user’s selection in the session, but
am wondering what should end up being stored. For now, I’ll assume i’m
always searching within one particular group (i.e., I’m looking for
items, not any combination of items, vendors, categories). But the
filters could specify, say – include the following categories, but
don’t include these manufacturers.

Should it be layers of hashes with selection information which is then
translated into SQL just before the ‘find’ statement? Or should I build
each “WHERE xxx” statement each time they add another selection filter
and concatenate them?

Can you point me to any good apps that lay out this sort of selection
process well?

Thanks much!
Jake