Question

I have implemented google appengine's endpoints client api libraries into my android application (Thanks to this tutorial: http://devthots.blogspot.ca/2012/07/building-awesome-android-apps-with.html). I am inserting my Entity Object (SOESave) like this:

SOESave save = new SOESave();

save.setId(uniqueKey.toString());
save.setName(name);
save.setDesc(desc);
Text jsonText = new Text();
jsonText.setValue(JSON);
save.setJson(jsonText);
save.setDownloadCount(0);
save.setBlobKey(s.toString());

Soesaveendpoint endpoint = CloudEndpointUtils.updateBuilder(endpointBuilder).build();
endpoint.insertSOESave(save).execute();

In Soesaveendpoint.java there is this method:

public CollectionResponse<SOESave> listSOESave(
        @Nullable @Named("cursor") String cursorString,
        @Nullable @Named("limit") Integer limit) 

If I understand correctly cursorstring will be added onto the end of "select from SOESave as SOESave" and used as a query on my datastore, and i can specify the limit here too.

What I cannot figure out is how I can make a query to my datastore that only shows results where the Title or Description fields contain a specific string. I couldn't find anything in the GQL syntax reference that would help me finding where results contain a string. Is this even possible with GQL? Thank you for any responses, and sorry that this post is a little lengthy!

Was it helpful?

Solution

The core question seems to be: can I query the datastore using something like SQL's LIKE statement? The answer to this is no. You can perform comparisons with >, <, or =, but can't do partial matches. For the latter, you'll have to use something like the Search API.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top