http://code.google.com/appengine/docs/java/datastore/queries.html#Query_Cursors

Limitations of Cursors
A few things to know about cursors:
You cannot use cursors with queries that use the IN or != filter operators.
To use a cursor, the app must perform the same query that provided the cursor, including the same kind, filters and filter values, ancestor filter, and sort orders. There is no way to fetch results using a cursor without setting up the same query. A query with a cursor does not always work as expected when the query uses an inequality filter or a sort order on a property with multiple values. Logic that de-duplicates the multivalued property for the query does not persist between queries, and may return a result more than once. Cursors depend on the index configuration that supports the query. In cases where multiple index configurations can support the same query, changing the index configuration for the query will invalidate cursors for that query. (For example, a query of only equality filters and no sort orders can be supported by the built-in indexes in most cases, and can also use a custom index if one is provided.) Cursors also depend on implementation details that may change with a new App Engine release that invalidates them. If an app attempts to use a cursor that is no longer valid, the datastore raises an exception. In Java, it raises an IllegalArgumentException (low-level API), a JDOFatalUserException (JDO), or a PersistenceException (JPA).

On Apr 29, 2011 4:39pm, Ravi Sharma <[email protected]> wrote:
i am not sure......but i think yes...i have not seen docs where it says so...if you can point me to that doc then it will be great.


On Sat, Apr 30, 2011 at 12:29 AM, John Wheeler [email protected]> wrote:

Can not use ORDER BY in GQL with IN or !=

:-)



On Fri, Apr 29, 2011 at 4:20 PM, Ravi Sharma [email protected]> wrote:

Now i am sure its some defect in Google App Engine
I tried following url for few entities it ran fine and it did updated the entities but still indexes are not working properly




for (Entity result : pq.asIterable()) {

Map allProp = result.getProperties();
for(Entry oneEntry:allProp.entrySet()){
System.out.println("update : "+oneEntry.getKey()+"="+oneEntry.getValue());



result.setProperty(oneEntry.getKey(), oneEntry.getValue());
}
result.setProperty("area", 10); //this line just to see that my changes are actually saving in datastore and it shows the datastore is being updated perfectly



//but still Indexes are not updated
System.out.println("Saving new Entity start");
datastore.put(result);
System.out.println("Saving new Entity Done");



}

I hope my query is valid for GAE(Low level datastore APIs)

select * from A where locationIds = and tfs in order by lastSaveDate DESC







locationKeys
▲
,
tfs
▲
,
lastSaveDate
▼





On Fri, Apr 29, 2011 at 10:21 PM, [email protected]> wrote:



In order to set indexed props with the low level,

entity.setProperty("foo", "bar")

Unindexed properties

entity.setUnindexedProperty("foo", "baz")

I apologize about getting the API wrong in my last message.




to get values out of indexed properties, you cast:

Date d = (Date) entity.getProperty("somedate")

If it is an unindexed property, you have to parse string

String mydata = ((Text) entity.getProperty("someunindexedprop")).getValue()




On Apr 29, 2011 2:17pm, Ravi Sharma [email protected]> wrote:
> Thanks John
> I wished Goole App JDO or Low level API could have done the same thing and wouldnt have to learn one more framework.....it may be easier but still i have to spend some time.



> By the way do you know correpsonding API(setIndexedProp()) in Datastore low level API...
>
> If some third party frmaework can do something then i am sure Low Level datastore api must be capable of doing the same.



>
> Thanks,
> Ravi.
>
>
> On Fri, Apr 29, 2011 at 9:52 PM, John Wheeler [email protected]> wrote:
>


> Ravi,

>
>
> I think you might need a MapReduce job that calls setIndexedProperty on all your affected entities. Here's mine for you to adapt, but if you don't know MapReduce, you'll have to check it out.



>
>
>
>
>

> public class QuickBulkJob extends AppEngineMapper {

>
> private static final Logger log = Logger.getLogger(QuickBulkJob.class.getName());



>
>
>
> @Override
>
> public void map(Key key, Entity e, Context context) throws IOException, InterruptedException {
>
> setIndexedProp(e, "deactivated");



>
> setIndexedProp(e, "feedbackReceived");
>
>
> setIndexedProp(e, "email");
>
>
> getAppEngineContext(context).getMutationPool().put(e);



>
>
>
> }
>
>
>
> private static void setIndexedProp(Entity e, String prop) {
>
> if (e.hasProperty(prop)) {
> e.setProperty(prop, e.getProperty(prop));



>
> }
> }
>
>
> }
>
>
>
> Best of luck to you.
>
>
>
>
>
> --
>
>
>
> You received this message because you are subscribed to the Google Groups "Google App Engine" group.



>
> To post to this group, send email to [email protected].
>
> To unsubscribe from this group, send email to [email protected].



>
>
> For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
>
>



>
>
>
>
>
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "Google App Engine" group.



>
> To post to this group, send email to [email protected].
>
> To unsubscribe from this group, send email to [email protected].



>
>
> For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
>
>



>
>




--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.

To post to this group, send email to [email protected].

To unsubscribe from this group, send email to [email protected].


For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.












--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.

To post to this group, send email to [email protected].

To unsubscribe from this group, send email to [email protected].


For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
















--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.

To post to this group, send email to [email protected].

To unsubscribe from this group, send email to [email protected].


For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.












--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.

To post to this group, send email to [email protected].

To unsubscribe from this group, send email to [email protected].


For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.




--
You received this message because you are subscribed to the Google Groups "Google 
App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to