views:

58

answers:

1

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")
+1  A: 

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.

Saxon Druce
Note that in any case you'll be limited to keyword searches or keyword prefix searches; there's no good way to do true substring searching.
Wooble