Hello, I have a problem, as you know in nakama in the browser you can search for a user using the % prefix to obtain a better search via username but using this function in lua I do not get the same result, it is mandatory to search for the same name.
Is there any way that I can have a better search with that function how does % work in the browser?
The username in Nakama is guaranteed to be unique, displayName exists to optionally allow users to display a different nickname which does not require to be unique.
If it has to be unique, then you should use usernames. You do not need fuzzy search to provide suggestions for unused usernames.
Friend suggestions are usually done by account linking with third party providers such as Facebook, or by using Storage Search to give suggestions based on some criteria (e.g.: player level). Alternatively, you can suggest random users with usersGetRandom.
While it could provide a better user experience, the reality is that a user not being able to find their friend because the string is not an exact match should happen seldom and is not worth the support because of the performance implications. The db is not the best place for fuzzy-search in highly concurrent scenarios.
If this is really important to you, it’s easy to implement with a custom query and a custom index (not required, but highly recommended).
Yeah well aware of these scenarios Just instead of username hassels down the road that can happen and then verification it is proven more easier to not mess around with it, with relog/re-session and just keep updating displaynames, at least in my case but this might not be the correct use case for displaynames/usernames.
UsersGetRandom can work for a while when i want to display suggested friends based on recent activity/level or some other factor and that is great choice
We don;t want to go third party way with FB as it is not cross platform in terms it is not available everywhere, and more and more people are less using it. Since we are targeting different markets FB is out of question for us, thus getting friends through it is not possible, we can only use game server and its services for that functionallity.
So in the end that gives me at least 2 choices:
Search by direct user ID → with some fluff that would get discarded in custom rpc call so it can be fetched and somewhat secured to be shared.
here have the same username if a player find tiosam get 1 of them, that why I want it, I decide to edit all name if you join to my game put it upper if the name uppers is already registered so add some random number that is bad, too bad make it.