0

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")
zjm1126
  • 34,604
  • 53
  • 121
  • 166
  • Possible duplicate: http://stackoverflow.com/questions/3172292/gql-find-all-entities-that-contain-a-substring – Wooble Sep 17 '10 at 03:18

1 Answers1

1

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
  • 17,406
  • 5
  • 50
  • 71
  • 1
    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 Sep 17 '10 at 10:44