Hi Max, I've got a similar servlet too...
I was guessing if there was a built-in method in GAE API. I would like also to delete and rebuild my indexes, but I cannot find the way... Do you know any strategy to cope with index management? Thank you Bye CRI On Dec 30, 8:18 pm, Max <[email protected]> wrote: > Hi CRI, > > I ran into this as well, however, the Datastore viewer only allows someone to > view a certain number of entries at a time. If you're app has thousands of > saved entities, it can be time consuming to delete them all. I created a few > simple tasks to do this for me. I make these both POSTs and only invoke them > manually from my computer using RESTClient. > > NOTE: I'm using objectify. > The first one loops through each class type and calls a servlet to delete > each of that type: > > Class[] clazzes = {Operator.class, > DDMessage.class, Event.class, > DailyStatus.class, DocumentGroup.class, Document.class, > StatusCapture.class}; > > for (Class clazz : clazzes) { > > Queue queue = > QueueFactory.getQueue("trashcan"); > queue.add(withUrl("/deletealloftype") > .param("kind", > clazz.getName()) > .method(POST)); > } > > This servlet deletes each item one after another until it hits the deadline, > and then it puts itself back in the task queue. > > try { > DAO dao = new DAO(); > > Class clazz = > Class.forName(request.getParameter("kind")); > > Query<Object> query = dao.ofy().query(clazz); > > QueryResultIterator<Object> iterator = > query.iterator(); > while (iterator.hasNext()) { > Object o = iterator.next(); > Objectify ofy = dao.fact().beginTransaction(); > ofy.delete(o); > ofy.getTxn().commit(); > } > > } catch (DeadlineExceededException dee) { > Queue queue = QueueFactory.getQueue("trashcan"); > queue.add(withUrl("/deletealloftype") > .param("kind", > request.getParameter("kind")) > .method(POST)); > } > > Hope this helps, > MG > > On Dec 29, 2010, at 11:00 AM, Didier Durand wrote: > > > > > > > > > Hi, > > > You can very easily empty your datastore using the Datastore viewer of > > the admin console: you can select and delete all entities from the > > viewer screen. > > > regards > > > didier > > > On Dec 29, 4:52 pm, cghersi <[email protected]> wrote: > >> Hi, > > >> I've got an app on GAE with 4 versions, up to now. > > >> Until the 4th version I had an entity with an ancestor, so its keys > >> were of the type (EntityID-AncestorID). > >> In the 5th version I changed my design and now this entity hasn't got > >> ancestor any more. Its keys are now simple long values. > > >> On my development server all is OK, given that my local datastore has > >> been correctly updated. > >> But with the online app I'm not able to remove the unused indexes and > >> to create entities with the new long key. > > >> How may I completely erase my datastore online in order to rebuild it > >> from scratch? > > >> Thank you very much!!! > >> Bye > >> CRI > > > -- > > 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/google-appengine-java?hl=en. -- 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 [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-java?hl=en.
