Backendless Support
 
Solved

Search on Users Table using Dictionary/Map approach returns incorrect results

iOS - Pod Version 4.0b3

  1. let userSearchQuery = DataQueryBuilder()
  2. userSearchQuery!.setSortBy(["name ASC"])
  3. userSearchQuery!.setPageSize(100)
  4. var whereClauseArray: [String] = []
  5. whereClauseArray.append("(isAdmin != TRUE OR isAdmin IS NULL)")
  6. whereClauseArray.append("(isTestUser != TRUE OR isTestUser IS NULL)")
  7. whereClauseArray.append("(isUserSearchable = TRUE)")
  8. whereClauseArray.append("(name LIKE '%\(searchString)%' OR lastname LIKE '%\(searchString)%' OR email LIKE '%\(searchString)%')")
  9. if let usersToExclude: [String] = project.members?.map({ ($0.user?.objectId as String?)! }) {
  10. whereClauseArray.append("(objectId NOT IN ('\( usersToExclude.joined(separator: "','") )'))")
  11. }
  12. userSearchQuery!.setWhereClause(whereClauseArray.joined(separator: " AND "))
  13. let dataStore = self.backendless?.data.ofTable("Users")
  14. dataStore?.find(
  15. userSearchQuery!,
  16. response: { ( response) -> () in
  17. },
  18. error: { (fault: Fault?) -> Void in
  19. }
  20. )

The results returned seem to be 10, in a random/unspecified order, from the user table

Leave a Comment

Comments (2)

photo
1

Thank you for reporting the problem. An internal ticket has been created and assigned to a developer.

Regards,

Mark

photo
1

The problem has been resolved in version 4.0b6. Please update the pod.

Regards,

Mark