用户工具

站点工具


google:gae:index-error

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

google:gae:index-error [2011/03/16 10:00] (当前版本)
行 1: 行 1:
 +====== GAE索引出错解决方法:no matching index found. This query needs this index ======
 +
 +Google AppEngine is really cool. You can host your app in few steps, ​ easy to setup, free, and allows you to develop web applications using Python, Django and Google Datastore.
 +
 +I’ve played a while with AppEngine, helping another projects, setting up my stuff there and got lots of tricks to help another users. Today (March 31, 2009) I faced a small problem, related to index.
 +
 +I was executing a query on my website, and got an error: ​ no matching index found. This query needs this index - kind: Comments properties: – name: page – name: data_issued direction: desc.
 +
 +What went wrong ? Appengine tries to make everything for you, but depending on the way you execute the Gql, you need to edit index.yaml adding some information to make it work. The query which I was executing is something like: db.GqlQuery(“SELECT * from Comments where page=:1 order by date_issued”). Since I don’t have any index which matches with the filter page=something,​ order by date, it gives me an error.
 +
 +To fix, just edit index.yaml, adding:
 +
 +<​code>​
 +- kind: Comments
 +properties:
 +- name: page
 +- name: data_issued
 +direction: desc
 +</​code>​
 +
 +After that, resync the index, using:
 +
 +<​code>​
 +appcfg.py update_indexes .
 +</​code>​
 +
 +Now you’ll be able to run your query 
 +===== 参考 =====
 +
 +
 +http://​rlabs.wordpress.com/​2009/​04/​01/​fixing-appengine-error-no-matching-index-found-this-query-needs-this-index/​
  
google/gae/index-error.txt · 最后更改: 2011/03/16 10:00 (外部编辑)