1
votes

I have a problem that I need to filter query result with Objectify. Typically here is what the String @Key field on stored entities would look like:

  • uid:jamesm:points
  • uid:jsmith:points
  • uid:jax:points
  • uid:ken:points

Now I want to do a query filter like this for the @Key field:

uid:j*:points

Where, I am expecting to get the first three (3) entities listed above. Is this possible with Objectify?

1
are you looking for a LIKE query ? code.google.com/p/objectify-appengine/wiki/… , maybe something similar to this 1 String start = "uid:j"; ... = ofy.query(MyEntity.class).filter("field >=", start).filter("field <", start + "\uFFFD:points"); - Daniel

1 Answers

2
votes

As described before, you can do this, but only if you compare start of the string: uid:j*

ofy.query(EntityClass.class).filter("property >=", "uid:j")
                            .filter("property <", "uid:j" + "\ufffd");