I'm building a search engine for cars. When viewing the search results, on the left there are filters to make the results more specific. I want to be able to show the sum of results that exist when each filter is set for the selected search.
For example the filters could be:
Make
Alfa Romeo (500)
BMW (2330)
....
Colors
Black (1000)
White (800)
....
I want to calculate the number in the parenthesis effecient without making tens of selects for that. Any idea how to cache this data or make a special table for that?
Keep in mind that everytime a filter is added the sums have to be re-calculated according to the new results.
You can check an example here
It's pretty tricky I think..
Thanks a lot for any help!
Dimitris
You should consider using the Solr search engine for such advanced functionality. There are several good Ruby gems for easy integration with Solr, you can find pointers here.