I have a question about how to set up a faceted search function in PHP and SQL. I wonder how the result set should be filtered based on the selected facet values.
For example if I have a facet menu with 5 filter options how should I filter the results. Should I use one big query that I expand based on the selected faceted values with AND structures like this:
SELECT
FROM
WHERE
AND..... AND..... AND
Or is it better to have one initial query and start fitering based on the result set. Like for example you have an array with objects of the type you want, and you just iterate trough this collection and filter the objects based on the selected facet values? Which option is better?
And does anybody know a good website or forum post with more information on how to setup a filter function?