Saturday, 15 January 2011

ios swift parse.com: How to query a "like" as well ignore case-sensitive search keyword? -


There are 2 name fields in my class I want to search using UISearchBar I

What is it now?

  query.whereKey ("front", hasPrefix: searchText)  

This works fine, But I also want to search for the field "back" as or , as well as I want to ignore case-sensitive writting.

As far as I know there is no "likes" search within parse? Does this mean I'm limited to the hasPrefix function?

Thank you!

Edit:

  func fetchAllObjectsFromLocalDatastore (searchText: string) {var query = PFQuery (className: "Card") if (searchText! = "") {Var front = PFQuery (className: "Card") front.whereKey ("front", string in: search text) var back = PFQuery (classname: "card") back.whereKey ("back", string: search text) query = PFQuery .orangeWithSubqueries ([front, back])} query.fromLocalDatastore () query.findObjectsInBackgroundWithBlock {(objects, error) - & gt; In void ...  

It works for me now!


No comments:

Post a Comment