0

I am trying to search a column in the datastore and I want to check if the column name starts with the search parameter but it should be case insensitive.

It allows me to use -

query.setFilter("name.startsWith(search)");

But when I try to use this-

search=search.toLowerCase();
query.setFilter("name.toLowerCase().startsWith(search)");

I get the following error message -

javax.jdo.JDOUserException: Problem with query : Unsupported method while parsing expression: InvokeExpression{[InvokeExpression{[PrimaryExpression{name}].toLowerCase()}].startsWith(ParameterExpression{search})}\nNestedThrowables:\ncom.google.appengine.datanucleus.query.DatastoreQuery$UnsupportedDatastoreFeatureException: Problem with query : Unsupported method while parsing expression: InvokeExpression{[InvokeExpression{[PrimaryExpression{name}].toLowerCase()}].startsWith(ParameterExpression{search})}

  • so "toLowerCase" is not supported by Google's AppEngine code. –  Sep 23 '17 at 06:04
  • Thanks for the reply @DN1. Is there a workaround I could use to achieve this? – Jitender Padda Sep 24 '17 at 06:40
  • Possible duplicate of [How to make case insensitive filter queries with Google App Engine?](https://stackoverflow.com/questions/3289781/how-to-make-case-insensitive-filter-queries-with-google-app-engine) Also of [this one](https://stackoverflow.com/questions/1658163/case-insensitive-where-clause-in-gql-query-for-stringproperty) and [this one](https://stackoverflow.com/questions/15374185/how-to-ignore-case-in-an-ndb-db-query). Essentially the workaround for Datastore search issues is to store the data you want to be searching in the datastore. In this case add a lowercase column to your data. – Yannick MG Oct 03 '17 at 15:02
  • Thanks @YannickMG for the workaround on this unfortunate limitation. – Jitender Padda Oct 04 '17 at 06:18

0 Answers0