The contains(key, substring) method is the one you want, but note that this will only match in the second and fourth documents.
The reason is that search queries are case sensitive. A common tactic is to add a cloud code handler to write content with the ability to search in another field before saving , for example:
Parse.Cloud.beforeSave("people", function(request, response) { request.object.set( "search_name", request.object.get("first").toLowerCase() + " " + request.object.get("last").toLowerCase() ); response.success(); });
Now you can use query.contains("search_name", searchString.toLowerCase()) to find them all.
If you want to be able to search only for the first name and not the last name, add another field ("search_first") or simply change the above, depending on your needs.
source share