Forum Moderators: coopster
I have a website using PHP5/MySQL with similar products and when a user searches for say 'macs' I need to say 'Your search results contain 5 products with 4 GB memory, 7 products with 2 GB memory' etc. These criteria needs to be based on the results so if a search does not yield any results with 4 GB memory then that refine option won't come up.
I would be grateful if someone could tell me how I can produce this 'refine criteria' based on the search results. The only option I can think of is running multiple COUNT queries but that's not a very efficient way.
-Dan
they could be predefined, if you want to count things then at some point you need to run a count() but maybe you only need to do it once a day, or a couple times a day, and store the results
So the criteria for drill down would be decided ahead of time, not random. Maybe they look at the most popular searches and use that data to create standard refine criteria.
just a guess but as you say, if they did those queries every time it would be pretty intensive. Maybe thy could use views for those as well, but that would be a lot of extra tables if there are a lot of criteria.
So it seems it's more complicated than it seems. I guess what you mean is that they cache the results and use from that cache.
Is there no other way at all to do this 'live/dynamic' like maybe add the results to an array (mysql_fetch_array) and do an array_count_values or something like that?
The only problem is, with out doing specific count queries it would force you to process all the results.
A couple of count queries for some predefined criteria that you decide on might be just fine.