I use Parse in order to manage my database.
I have a tableView with a searchBar. It's working very well.
My function about the query is the following :
override func queryForTable() -> PFQuery {
var query = PFQuery(className: "students")
if searchBar.text != "" {
query.whereKey("prenom", containsString: searchBar.text.uppercaseString)
}
query.orderByAscending("prenom")
return query
}
This works very well.
But now I want to add multiple key into my research, like :
query.whereKey("prenom", containsString: searchBar.text.uppercaseString)
query.whereKey("nom", containsString: searchBar.text.uppercaseString)
But this code, and it is normal, do : "I want searchBar.text IN prenom AND nom" And that's not what I want. I want to search for exemple : "John", and this result has to be "john" in "prenom" OR in "nom".
I don't know how to return a PFQuery with multiple keys into the query.
Does someone have an idea ?