0

How can I implement a contains method in Google Datastore. Google doesn't provide a string contains filter of a property because it will cause a table scan.

How can I implement it another way.

Dan McGrath
  • 37,828
  • 10
  • 90
  • 123
Pavan Tiwari
  • 2,716
  • 2
  • 25
  • 56
  • Have you tried something? Basically this is not possible with datastore, but depending on your use case you could still implement something. Like.. index n-grams for each phrase you want to be indexes? – Dmytro Sadovnychyi Sep 30 '16 at 12:42
  • 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) – Dan McGrath Sep 30 '16 at 13:54

1 Answers1

1

You are right: the Datastore, by its NoSQL nature, does not directly support substring matches, case-insensitive matches, or so-called full-text search. Your program would be able to implement case-insensitive matches and even full-text search using computed properties. This solution may work well, depending on the actual needs of the application. You can use the app engine search API for full-text matching on string fields. If you need to retrieve very large result sets, Datastore API is more appropriate.

George
  • 1,184
  • 6
  • 11