没办法,GAE不支持全文检索 2009/4/19 saintthor <saintt...@gmail.com>
> > 谢谢回复。 > > 我问的是字符串属性部分匹配的问题。按你的方法,只能匹配开头。需要匹配中间的时候,比如在前例里,查找含有 ccc 的对象,该怎么做? > > > HOW to select the entity with "ccc" in strprop then? > > On 4月19日, 上午12时08分, 风笑雪 <kea...@gmail.com> wrote: > > You can read this document: > http://code.google.com/appengine/docs/python/datastore/queriesandinde... > > > > Give you a sample code: > > > > class M(db.Model): > > s = db.StringProperty() > > > > class H(webapp.RequestHandler): > > def get(self): > > M(s='aaa bbb ccc ddd').put() > > M(s='eee ddd ccc fff').put() > > M(s='eee').put() > > M(s='eee ').put() > > M(s='eef').put() > > > > entities = M.all().filter('s >= ', 'eee').filter('s <= ', u'eee' + > > u'\ufffd').fetch(10) > > # u'\ufffd' is the largest possible Unicode character > > for entity in entities: > > self.response.out.write(entity.s + '<br />') > > > > Result: > > > > eee ddd ccc fff > > eee > > eee > > > > 2009/4/18 saintthor <saintt...@gmail.com> > > > > > > > > > entities1.strprop = "aaa bbb ccc ddd" > > > entities2.strprop = "eee ddd ccc fff" > > > > > using qerry or gql, HOW to select the entity with "eee" in strprop? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---