PanosJee
PanosJee

Reputation: 3866

AppEngine Datastore query with inequality and sort (different attribute). Workaround?

Hey guys I know this is an old issue but I am wondering if there any news about it: I have a simple query where I want to do:

filter('created >=', somedatetime).order('-counter')

I tried: filter('created >=', somedatetime).order('-created').order('-counter') but because created is a datetime the results are pretty bad.

A user can go through a list with infinite scrolling and we can choose a time window of 7,30,90 days but it seems I cannot this very simple query.

I was thinking of break created to two attributes (dayofyear, year) so that I could use the IN operator but this could be hard as I have about 2M entries.

Any ideas?

Upvotes: 0

Views: 187

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

No, there's no way around this. This limitation exists due to how indexes are constructed. You'll simply have to do either the sorting or the filtering in memory, just as other databases would.

Upvotes: 2

Related Questions