I have to create a browse page like monter.com or dmoz directory. My problem is the counts for each category. What's the best practive to do a similar thing? I am using PHP/MySQL Thx!
Asked
Active
Viewed 349 times
0
-
Welcome to SO. Please describe in more detail what you want to do and what you are working with. – Pekka Jun 23 '10 at 09:26
-
I want to create page like http://www.dmoz.org/Business/ or http://jobsearch.monster.com/Browse.aspx. In my project, I have Geo informations Country->State->Region->City and Fields of activity Medecine, Loyer... I display categories like this * Alabama (1963) * Alaska (341) Whith a posibility to filter and to reduce the scope. My problem is the counts. Have 260 000 city, 62 000 region, about 200 country, and 50 Field of activity and 400 sub field. To many calculation job if I want to precalculate it, and performance is important I want an instant page (I use CQRS architecture) – chahedous Jun 23 '10 at 09:37
-
Is it a bad question? Guys Any idea? – chahedous Jun 23 '10 at 11:13
2 Answers
0
Did you try to implement it the way that you calculate these numbers dynamically when the page loads? How do you know that it is indeed a performance issue? Calculations are pretty fast these days.
Otherwise put a counter field next to each (sub-)category. When inserting(/deleting) a new post, then you update the counter of all categories it belongs to.
As a result, when you query any category, or set of categories, you will have a counter field for each giving the exact numbers of posts the category holds.

sibidiba
- 6,270
- 7
- 40
- 50
-
I tryed to calculate these numbers dynamically when the page loads but it takes to much time, because for each geographique level I have to count the number of all sub level AND the count for each activity field. it's about 150 count a click. Denormalizing the table with adding a counting field in each category / sub category is not relevante because for each geo lvl I have fields of activity to denormalize I have to create count field for each geolocation and vice versa. There is no other issues to do like dmoz.org/Business or jobsearch.monster.com/Browse.aspx pages? – chahedous Jun 23 '10 at 14:06
0
Solr can do that with Faceted Search http://lucene.apache.org/solr/tutorial.html#Faceted+Search I'll test it now.

chahedous
- 115
- 3
- 9