Is there a better way of searching the datastore for and attribute  "like
SomePattern* or contains word SomeWord" or is below OK?

I am doing two queries and joining the results. Most searches will return <5
entries.

def SearchDatastoreForFoo (m, s):

    l=[]
    m=m.upper()
    # search_string is StringProperty
    q=db.GqlQuery("SELECT * FROM Foos WHERE search_string >= :1 AND
search_string < :2", m, unicode(m) + u"\ufffd")
    results=q.fetch(20)
    for r in results:
        l.append(r.name)

    # search_list is ListProperty(str)
    q2=db.GqlQuery("SELECT * FROM Foos WHERE search_list = :1", m)
    results=q2.fetch(20)
    for r in results:
        if r.name not in l:
           l.append(r.name)

    return l

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to