0

I have an object Person with fields firstName,lastName etc. After finding the list of persons available. I need to find persons whose firstName contains substring "ho" . How can I do this?

I would have used LIKE with wild cards but my application is hosted on google app engine, so I cant use LIKE in the SQL Query. Tried it before did not work. Any suggestions how I can do this without traversing each object in the list?

om-nom-nom
  • 60,231
  • 11
  • 174
  • 223
  • possible duplicate of [Google App Engine: Is it possible to do a Gql LIKE query?](http://stackoverflow.com/questions/47786/google-app-engine-is-it-possible-to-do-a-gql-like-query) – Amber Mar 20 '12 at 07:56

2 Answers2

1

You really need to think of the datastore in a different manner than a relational database. What that essentially means is that you have to be smart about how you store your data to get at it. Without having full text search, you can use a strategy to mimic full text search by creating a key list of searchable words and storing them in a child entity in an entity group. Then you can construct your query to return the keys of the parent object that match your "query string". This allows you to have indexing without the overhead of full text search.

Here's a great example of it using Objectify but you can use anything to accomplish the same thing (JPA, JDO, low level API).

http://novyden.blogspot.com/2011/02/efficient-keyword-search-with-relation.html

DavidB
  • 1,726
  • 2
  • 15
  • 17
0

You can't, at least, not if you're using the BigTable-based datastore.

Amber
  • 446,318
  • 77
  • 595
  • 531