Question

I am using Kinvey as my back-end for my android app. I have followed the guide on their datastore querying found here. It seems that the queries are case-sensitive.

How do I make a case-insensitive query?

Was it helpful?

Solution

I posted the same question in the Kinvey forums, and I got the following answer:

The Query class has a regex(String field, String regex) method which you can use for this by defining a case-insensitive regex.

Something like: Query myQuery = new Query().regex("myJSONKey", myRegex);

Here is the documentation: http://devcenter.kinvey.com/android/reference/api/java/reference/com/kinvey/java/Query.html#regEx(java.lang.String, java.lang.Object)

Credit to Edward Fleming.

However, for anyone who is interested, according to here:

It should be noted that searching with regex's case insensitive /i means that mongodb cannot search by index, so queries against large datasets can take a long time.

I believe Kinvey uses mongodb for their datastore. Anyways, I used the suggestion mention in the same post, and it works perfectly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top