Thanks to speedplane for the suggestion. To answer my own question, the algorithm I suggested did indeed work, returning a cursor.
Cheers, Glenn On Dec 21 2010, 10:59 pm, Glenn <[email protected]> wrote: > I'm trying to find a workaround for some query cursor limitations. > Say that I have entities with date and an value which is a > multiple of ten from 0 to 100. > > I need to get paginated entities sorted by date and with the > integer field above a given threshold, along the lines of the > pseudo code: > > SELECT * FROM entity WHERE integer >= 50 ORDER BY date DESC > > What's the best way to do this? My thoughts are below. > > As the docs say, I can't use an inequality on the integer field > since then I'd have to sort by the integer first. Instead of using > integer values, I though Icould use strings: '0', '10', '20', etc., > and > then use a query like this to get entities with a value of 70 or more: > > SELECT * FROM entity WHERE integer IN [70,80,90] ORDER BY date DESC > > But as the docs say, cursors can't be obtained from queries for > entities that use contains() (i.e., IN) or even disjunctions > (value == '70' || value == '80'...). > > My question is would a multiple value property (a list) work for > this? My idea is to set the all the values up to the true entity > value, e.g., if the entity value was '40', then the MVP would be > ['0', '10', '20', '30', '40']. Then if the threshold was 20, > then entities such as this would (I believe) be returned by a query > like > > SELECT * FROM entity WHERE value == '20' ORDER BY date DESC > > Can you obtain a cursor from such a query or is there a better way? > > Thanks, > Glenn -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
