To answer my own question:

If you search for Keys rather than Strings, it works properly. However, this
is still a small defect IMO.

Recorded here, with a test-case attached:
http://code.google.com/p/googleappengine/issues/detail?id=2471

Regards,
  Viktor


On Sat, Dec 5, 2009 at 11:36 PM, phraktle <phrak...@gmail.com> wrote:

> Hi,
>
> I'm using the Java low-level Datastore API, in a local unit test (as
> described here:
> http://code.google.com/appengine/docs/java/howto/unittesting.htm):
>
> I'm trying to run a prefix search on __key__ (which I generated in the
> first place), as per the usual range-query hack:
>
> q.addFilter(Entity.KEY_RESERVED_PROPERTY,
> Query.FilterOperator.GREATER_THAN_OR_EQUAL, prefix);
> q.addFilter(Entity.KEY_RESERVED_PROPERTY,
> Query.FilterOperator.LESS_THAN, prefix + '\ufffd');
>
> This fails to return any results. Note, that this technique works for
> all other properties, just not __key__.
>
> It's my impression that __key__ does not have a descending index by
> default. So, I've tried adding this to datastore-index.xml:
>
>        <datastore-index kind="Catalog" ancestor="false">
>                <property name="__key__" direction="desc" />
>        </datastore-index>
>
> But this had no impact. In fact, based on a quick trace, I've seen no
> evidence that the GAE code invoked during the unit test even tries to
> open this file.
>
> I believe this might be a bug in the AppEngine implementation
> (shouldn't an exception be thrown if there's no index on the queried
> field)? Or at least something that was overlooked...
>
> Is there a workaround?
>
> Thanks,
>  Viktor
>

--

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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to