3

The Quickblox docs say you can perform an OR search query using the approach below.

1.name[or]=sam,igor 2.name[or]=sam&lastname[or]=johnson
1.Will return records with name sam or igor 2.Will return records with name sam or lastname johnson

Using the code below:

NSMutableDictionary *getRequest = [NSMutableDictionary dictionary];
NSNumber *userID = [NSNumber numberWithInteger:_user.loggedInUser.ID];
[getRequest setObject:userID forKey:@"_user_id[or]"];
[getRequest setObject:userID forKey:@"destination_id[or]"];
[getRequest setObject:@"created_at" forKey:@"sort_desc"];
[QBCustomObjects objectsWithClassName:@"Messages" extendedRequest:getRequest delegate:self context:@"Messages"];

The results come back as if I'm performing an AND search on _user_id and destination_id but I need it to perform an OR search on both fields. Can anyone point out how do do this search properly?

Eric Alford
  • 926
  • 7
  • 11
  • Not sure that you can use _user_id, I think user_id is correct. Read here http://quickblox.com/developers/Custom_Objects#Module_description – Rubycon May 30 '14 at 10:28
  • Doing an or search on user_id instead of _user_id works. Though this is confusing because searching on _parent_id works as well as _user_id but when doing an or search you have to use user_id. Seems inconsistent but it does work. Thank you. – Eric Alford May 31 '14 at 18:54
  • 1
    Please use variables format from this guide http://quickblox.com/developers/Custom_Objects#Module_description – Rubycon Jun 02 '14 at 06:57

0 Answers0