Hi,
I'm exploring the best to do the following:
There is a view where the user can select various options, and each option builds a search query. The options are in different sections, like location, type, category, etc.
The screen will show all the options for each section. Next to each option, I need to put the number of results that are expected if they choose that option.
For example, One section might look like this: Cities: Los Angeles (40) Detroit (1543) Washington (667)
Now, if they select a category, the city result sizes need to change because the query will be filtered to those entities with both the category and the city:
Cities: Los Angeles (2) Detroit (150) Washington (40)
This sort of thing can get widely complicated. In my mind, I have to run a "count" query for every single option on the screen and "pretend" that they selected it. However, isn't this going to be really slow if there are 80 different selections on the screen? I can't possibly run 80 queries...
What is the best way in hibernate to dig at this kind of information in a performant way? I already have the filtering query working - works great. I have everything else working just splendidly. Those count queries appear to be annoying.
|