I haven’t timed the queries but there’s way more than 4 queries to be done.
For instance if I build a drill-down to zoom in on my city (Bordeaux), I would need to build something like this :
- Aquitaine (administrative_area_level_1)
- Gironde (administrative_area_level_2)
- Bordeaux (locality)
- Talence
- etc.
So to build the whole tree I’d need to do nested loops over the first two fields (administrative_area_level_1 & administrative_area_level_2).
Assuming there’s N administrative_area_level_1 and M administrative_area_level_2, I’d need N*M queries to list all localities.
That seems a bit brutish.
I’ve read a bit about nested_queries in web2py but there isn’t much to be found. Is it a deprecated mechanism ?
Should I use rows.find() & rows.sort() then ?