Java App Engine - ranked counter

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-03-23T23:24:32Z Indexed on 2010/03/25 2:33 UTC
Read the original article Hit count: 435

Filed under:
|
|

I understand the sharded counter, here: http://code.google.com/appengine/articles/sharding_counters.html The problem is that a simple counter will not work in my application. I am sorting my entities by a particular variable so I am returned not so much a count, but more of a rank. My current method is:

SELECT COUNT(this) FROM Entity.class WHERE value <= ?

Result + 1 is then the rank of the parameter in relation to the value variable in the persistent Entity objects. The limitation of this is the highest rank being returned is 1001 because count() can give a maximum of 1000. The reason I cannot store the rank on the Entity object is that the ranks are updated very often, and re-setting this rank variable would be much too costly.

Any ideas on the best way to accomplish this?

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about java