google app engine - GAE and Objectify query and error using order() -


i working on demo project , 1 of methods provides basic query on type.

    public list<conference> filterplayground(){        query<conference> query = (ofy().load().type(conference.class)).order("name");        query = query.filter("topics =", "medical innovations");         query = query.filter("city =","london");        return query.list(); } 

my conference entity has @index name, city , topics.

but when run method in api explorer exception... (see below). quick pointers why using order method causes this. know order method without there no error.

uncaught exception servlet java.io.ioexception:    com.google.appengine.repackaged.org.codehaus.jackson.map.jsonmappingexcepti on: no matching index found. recommended index is: - kind: conference  properties:  - name: city  - name: topics  - name: name  suggested index query is: <datastore-index kind="conference" ancestor="false" source="manual"> <property name="city" direction="asc"/> <property name="topics" direction="asc"/> <property name="name" direction="asc"/> </datastore-index>  (through reference chain: java.util.hashmap["items"]) @ com.google.api.server.spi.response.servletresponseresultwriter.writevalueas    string(servletresponseresultwriter.java:187) @ com.google.api.server.spi.response.servletresponseresultwriter.write(servletresponseresultwriter.java:74) @ com.google.api.server.spi.systemservice.invokeservicemethod(systemservice.java:394) @ com.google.api.server.spi.systemserviceservlet.execute(systemserviceservlet.java:113) @ com.google.api.server.spi.systemserviceservlet.dopost(systemserviceservlet.java:71) @ javax.servlet.http.httpservlet.service(httpservlet.java:637) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1166) @ com.google.apphosting.utils.servlet.parseblobuploadfilter.dofilter(parseblobuploadfilter.java:125) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.runtime.jetty.savesessionfilter.dofilter(savesessionfilter.java:37) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.jdbcmysqlconnectioncleanupfilter.dofilter(jdbcmysqlconnectioncleanupfilter.java:60) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java:48) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) @     com.google.apphosting.runtime.jetty.appversionhandlermap.handle(appversionhandlermap.java:257) @     org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) @ org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) @ com.google.apphosting.runtime.jetty.rpcrequestparser.parseavailable(rpcrequestparser.java:76) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ com.google.apphosting.runtime.jetty.jettyservletengineadapter.servicerequest(jettyservletengineadapter.java:145) @ com.google.apphosting.runtime.javaruntime$requestrunnable.run(javaruntime.java:511) @ com.google.tracing.tracecontext$tracecontextrunnable.runincontext(tracecontext.java:446) @ com.google.tracing.tracecontext$tracecontextrunnable$1.run(tracecontext.java:453) @ com.google.tracing.currentcontext.runincontext(currentcontext.java:276) @ com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontextnounref(tracecontext.java:312) @ com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontext(tracecontext.java:304) @ com.google.tracing.tracecontext$tracecontextrunnable.run(tracecontext.java:450) @ com.google.apphosting.runtime.threadgrouppool$poolentry.run(threadgrouppool.java:235) @ java.lang.thread.run(thread.java:745) caused by:     com.google.appengine.repackaged.org.codehaus.jackson.map.jsonmappingexception: no matching index found. recommended index is: - kind: conference   properties:   - name: city   - name: topics   - name: name  suggested index query is: <datastore-index kind="conference" ancestor="false" source="manual"> <property name="city" direction="asc"/> <property name="topics" direction="asc"/> <property name="name" direction="asc"/> </datastore-index>  (through reference chain: java.util.hashmap["items"]) @ com.google.appengine.repackaged.org.codehaus.jackson.map.jsonmappingexception.wrapwithpath(jsonmappingexception.java:218) @ com.google.appengine.repackaged.org.codehaus.jackson.map.jsonmappingexception.wrapwithpath(jsonmappingexception.java:183) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.serializerbase.wrapandthrow(serializerbase.java:140) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.mapserializer.serializefields(mapserializer.java:266) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.mapserializer.serialize(mapserializer.java:186) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.mapserializer.serialize(mapserializer.java:23) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.stdserializerprovider._serializevalue(stdserializerprovider.java:610) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.stdserializerprovider.serializevalue(stdserializerprovider.java:256) @ com.google.appengine.repackaged.org.codehaus.jackson.map.objectwriter._configandwritevalue(objectwriter.java:456) @ com.google.appengine.repackaged.org.codehaus.jackson.map.objectwriter.writevalueasstring(objectwriter.java:393) @ com.google.api.server.spi.response.servletresponseresultwriter.writevalueasstring(servletresponseresultwriter.java:183) ... 38 more 

caused by: com.google.appengine.api.datastore.datastoreneedindexexception: no matching index found. recommended index is: - kind: conference properties: - name: city - name: topics - name: name

the suggested index query is:

at com.google.appengine.api.datastore.datastoreapihelper.translateerror(datastoreapihelper.java:59) @ com.google.appengine.api.datastore.datastoreapihelper$1.convertexception(datastoreapihelper.java:128) @ com.google.appengine.api.utils.futurewrapper.get(futurewrapper.java:97) @ com.google.appengine.api.utils.futurewrapper.get(futurewrapper.java:89) @ com.google.appengine.api.datastore.futurehelper.getinternal(futurehelper.java:76) @ com.google.appengine.api.datastore.futurehelper.quietget(futurehelper.java:36) @ com.google.appengine.api.datastore.basequeryresultssource.getindexlist(basequeryresultssource.java:159) @ com.google.appengine.api.datastore.basequeryresultssource.loadmoreentities(basequeryresultssource.java:192) @ com.google.appengine.api.datastore.basequeryresultssource.loadmoreentities(basequeryresultssource.java:171) @ com.google.appengine.api.datastore.queryresultiteratorimpl.ensureloaded(queryresultiteratorimpl.java:148) @ com.google.appengine.api.datastore.queryresultiteratorimpl.hasnext(queryresultiteratorimpl.java:64) @ com.googlecode.objectify.impl.keysonlyiterator.hasnext(keysonlyiterator.java:29) @ com.googlecode.objectify.impl.chunkiterator.next(chunkiterator.java:48) @ com.googlecode.objectify.impl.chunkiterator.next(chunkiterator.java:20) @ com.google.common.collect.iterators$5.hasnext(iterators.java:597) @ com.google.common.collect.iterators$peekingimpl.hasnext(iterators.java:1216) @ com.googlecode.objectify.impl.chunkingiterator.hasnext(chunkingiterator.java:51) @ com.google.common.collect.lists.newarraylist(lists.java:144) @ com.google.common.collect.lists.newarraylist(lists.java:125) @ com.googlecode.objectify.util.makelistresult.translate(makelistresult.java:21) @ com.googlecode.objectify.util.makelistresult.translate(makelistresult.java:11) @ com.googlecode.objectify.util.resulttranslator.nowuncached(resulttranslator.java:21) @ com.googlecode.objectify.util.resultcache.now(resultcache.java:30) @ com.googlecode.objectify.util.resultproxy.invoke(resultproxy.java:34) @ com.sun.proxy.$proxy30.iterator(unknown source) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.collectionserializer.serializecontents(collectionserializer.java:45) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.collectionserializer.serializecontents(collectionserializer.java:23) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.asarrayserializerbase.serialize(asarrayserializerbase.java:86) @ com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.mapserializer.serializefields(mapserializer.java:262) ... 45 more 

your app needs different index definition ordered queries. direction needed well. see how fix index error when querying gae datastore?

typically devserver able automatically generate/update indexes in local development environment according queries local app performs. need manually upload updated index file gae (and make sure indexing completed) before gae app can use it.

if devserver fails automatically generate/update index file can still manually.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -