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<String, Object> allProp = result.getProperties(); > for(Entry<String, Object> 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 *=* <SomeKey> and tfs *in* <Lit of Long > types> 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.
