Closed GoogleCodeExporter closed 9 years ago
Original comment by kumar.mcmillan
on 16 Aug 2010 at 1:26
Done, except for reviews part. It's not obvious to me how to do that, since GAE
does not support JOIN operations in queries. Therefore, paging becomes
problematic when displaying only albums with reviews.
Original comment by jawax...@gmail.com
on 24 Aug 2010 at 6:20
One easy solution would be to add a reviewed field to albums.
Original comment by jawax...@gmail.com
on 24 Aug 2010 at 6:21
Oh duh, that's already there. Nevermind.
Original comment by jawax...@gmail.com
on 24 Aug 2010 at 6:23
Argh. But there is another problem. GAE does not support multiple inequality
filters on different properties in the same query. Hence, paging is problematic
for displaying, for example, all reviewed (num_reviews > 0) albums starting
with the letter D (title >=D and title < D + \uffff). We can choose to display
all reviewed albums, but then GAE requires that the resulting list be sorted by
num_reviews (not by title).
Original comment by jawax...@gmail.com
on 24 Aug 2010 at 7:25
you can't just chain them together?
q = filter('num reviews >', 0).filter('title >=', 'D').filter('title <', D +
\uffff)
Original comment by kumar.mcmillan
on 24 Aug 2010 at 8:10
No, you'll get a BadFilterError exception since GAE does not support inequality
filters on different properties in the same query. If you need to do that, you
need to post-process the results of a query. However, this is problematic for
efficient paging, which relies on single queries. I have been thinking of
writing a Pager wrapper to deal with the post-processing in a transparent
manner. So, if you get multiple inequality filters in a single query, run the
query on the first inequality with the normal Pager. Then post process on the
other filters. The result may yield less entries than the page size. So loop on
the original query until you fill up the page. You need to keep track of the
next page bookmark while doing so. Using this method, you will only be able to
sort on the first inequality field.
An alternative for this particular issue is to add a boolean property to albums
"is_reviewed". Then you can add a filter using equality, which is permissible.
Original comment by jawax...@gmail.com
on 29 Aug 2010 at 10:49
Done. Added an is_reviewed field to artists and tracks.
Original comment by jawax...@gmail.com
on 5 May 2011 at 7:07
Original issue reported on code.google.com by
billyk...@gmail.com
on 24 May 2010 at 8:22