Search code examples
androidsearchparse-platform

how to Parse Query search case insensitive in android?


I am using the parse cloud to store data . in this case I have a table "MyUser" in this table I want to search user by name in case insensitive.

Search is working fine but the search operation is not case insensitive

I have to search case insensitive

here is my code.:-

ParseQuery<ParseObject> query = ParseQuery.getQuery("BetsUpUser");
query.whereContains("name", searchData);
query.findInBackground(new FindCallback<ParseObject>() {
     public void done(List<ParseObject> objList,ParseException e) {
       if (e == null) {
          Log.d("score","@@@@Retrieved " + objList.size()+ " scores");

       } else {
          Log.d("score", "@@@Error: " + e.getMessage());
       }
    }
});

Thanks in advance.


Solution

  • I Solve the problem of case insensitive string Parse Query

    replace the line

    query.whereContains("name", searchData);
    

    with

    query.whereMatches("name", "("+searchData+")", "i");