Discover users in your community through powerful search and query capabilities. social.plus SDK provides methods to search users by display name and retrieve user collections with various sorting options.
Deleted users are automatically excluded from all search and query results to maintain data integrity.
Query for users by their display name, receiving a collection of AmityUser matching your search. It requires two parameters: the display name you’re searching for, and a ‘sort option’ from the AmityUserSortOption enum.
With the displayName sorting option, users are sorted alphabetically by their display names using ICU collation for the English locale. This means that special characters such as Ä are treated as variants of A. For example, a sorted list might appear as: adam, Älex, Alice, Arthur, charlie, Kristen.When providing a search keyword, the API performs an exact-match lookup for special characters:
Searching for “Äli” will only return users whose display name contains “Äli” (e.g., “Älise”)
Query for users to receive a collection of AmityUser based on a single parameter: a ‘sort option’ from the AmityUserSortOption enum. Sort the list by options such as displayName, firstCreated, or lastCreated. The displayName sort option will be specified by default if it isn’t specified.
With the displayName sorting option, users are sorted alphabetically by their display names using ICU collation for the English locale. This means that special characters such as Ä are treated as variants of A. For example, a sorted list might appear as: adam, Älex, Alice, Arthur, charlie, Kristen.Deleted users are excluded from the results
var token: AmityNotificationToken?func queryUsersExample() { let liveCollection = userRepository.getUsers(.displayName) token = liveCollection.observe { collection, change, error in // Handle live collection notification here }}