how to get the info which contains 'sss', not "= ",
this is my code:
class Marker_latlng(db.Model):
geo_pt = db.GeoPtProperty()
class Marker_info(db.Model):
info = db.StringProperty()
marker_latlng =db.ReferenceProperty(Marker_latlng)
q = Marker_info.all()
q.filter("info =", "sss")
but how to get the info which contains 'sss', not "=",
has a method like开发者_如何转开发 "contains "?
q = Marker_info.all()
q.filter("info contains", "sss")
Instead of using a StringProperty
, you could use a StringListProperty
. Before saving the info string, split it into a list of strings, containing each word.
Then, when you use q.filter("info =", "sss")
it will match any item which contains a word which is each to "sss"
.
For something more general, you could look into app engine full text search.
精彩评论