Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by JJ · Jan 11 at 05:04 PM · apisunity3dFriends

Filter Player by Username

Hello! I am trying to create a feature whereby one user can search for other players through a search field.

For instance, there could be 5 players - > "Tom", "Terry", "Terrence", "Bob" and "Adam"

Suppose "Bob" enter in the search field the character "T", I should be able to receive a list of "Tom", "Terry" and "Terrence", and when he enters the 2nd character e, only "Terry" and "Terrence" should remain.

I saw a similar question posted 5 years ago

(https://community.playfab.com/questions/97/205460918-search-other-player.html) and understand that the recommendation is to get all the player once, then search on the client-side.

Since its been quite a long time, I would like to ask the PlayFab admins if this is still the recommended approach?

Cheers!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Jan 11 at 09:39 PM

Since we do not support wildcard (or partial) search on usernames via the API calls (since that would be inefficient and expensive), you would need to store the player usernames in an external database and query that. You could use the events (via a Webhook or the Event Export functionality) to populate that data. But please bear in mind that you would need to account for any privacy requirements for that data.

Comment

People who like this

0 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JJ · Jan 12 at 02:29 AM 0
Share

Hi Brendan, I think that would be an overkill for me since its only a minor project for me. I have seen the usage of getting player segment, and I think it fits my purpose perfectly. I only have i.e. 5 users for testing now, I merely want to grab all user and create a filter function from there.

May I clarify how I can get a List of All Player? So far I have only found
`PlayFabClientAPI.GetPlayerSegments`, but I cant seem to get it to work. I would like to use the solution of getting all players, then doing the filtering at client side.

Thank you very much for reading this

avatar image Brendan ♦♦ JJ · Jan 12 at 02:43 AM 0
Share

There isn't a valid path for this using the built-in functionality.

GetPlayersInSegment will return the specific users in a segment. If it's a non-trivial number of users, you would use the Continuation Token to get the next set iteratively, until you're done. However:

A) GetPlayersInSegment should not be triggered by a client call (to Cloud Script or a server) because it is very computationally expensive. In fact, because it is, the call rate limit on that endpoint is for the title, not for individual clients or servers. So if you tried to do this, you'd run into that limit even with a very small number of players.

B) This would be very expensive for you, since it would hit the Profile Read meter (Profile Reads Meter API Description - PlayFab | Microsoft Docs). It would "tick" that meter based on the total volume of data returned, per call - specifically max(1, bytes returned divided by 1,000) each call.

avatar image JJ Brendan ♦♦ · Jan 12 at 04:00 AM 0
Share

Hi Brendan. Thanks very much for the prompt response.
It seems like my approach isn't very suitable after hearing your feedback. May I clarify if your recommendation is for me to store the player data in both playfab and a external db, so if I want to i.e. filter by username, I will write query to filter FROM my external db - since PlayFab doesn't support this feature/is not effective for this purpose?

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    What happened to the OneSignal addon? (having iOS push errors with PlayFab) 1 Answer

    OffTopic help. Regarding Facebook Friends profile pictures. 1 Answer

    Google Play Games: Silent Login 1 Answer

    OAuth consent screen and Playfab: Can't verify because I don't own playfab.com domain 2 Answers

    Add Friend using friend request with accept/decline option 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges