# ListLeaderboardRecords AroundOwnerAsync or ListTournamentRecords AroundOwnerAsync support bucket?

**URL:** <https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362>\
**Category:** Client Libraries\
**Created:** [June 17, 2024, 4:33pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362 "2024-06-17T16:33:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [June 17, 2024, 4:33pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/1 "2024-06-17T16:33:42Z")

</div>

base on the bucket leaderboard best practice, may i ask any support for there 2 API

ListLeaderboardRecordsAroundOwnerAsync  
ListTournamentRecordsAroundOwnerAsync

seems like there is no input parameter of ownerIds in the client lib signature, should we implement it by ourselves or any suggestions for these 2 APIs for bucket leaderboard/tournament?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 4:54pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/2 "2024-06-17T16:54:14Z")

</div>

Hello @mengxin,

This API is meant to return records above and below the owner, if you need multiple results you could have a custom RPC that invokes it for each entry in a list of userIds and returns the multiple results in a single response.

Best.

---

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [June 17, 2024, 5:02pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/3 "2024-06-17T17:02:58Z")

</div>

Sorry, little confused. This API will return records around the owner on full leaderboard right?

if we use the bucket leaderboard, the owner of the records around the current player may not in the bucket players list, then it is possible all the records returned from this API is not useful for the current player.

is there any way we can get the recorded around the owner and in the bucket userId list?

i am also thinking if there is no API, whether we can use the API `leaderboardRecordsListCursorFromRank` to achieve?

1. `ListLeaderboardRecordsAroundOwnerAsync` → get the rank of current user
2. `leaderboardRecordsListCursorFromRank` → get curser of the current user by rank (maybe rank - 10, if we want to get 20 around players)
3. `ListTournamentRecordsAsync` use this API with the curse and ownIds to get the recorded around the owner.

is there any issue for this solutions?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 5:29pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/4 "2024-06-17T17:29:35Z")

</div>

I’m also a bit confused, yes the `ListLeaderboardRecordsAroundOwnerAsync` APIs return the records around the target `ownerId` in the request (the ownerId param), not the current session user.

If using bucketed leaderboards you should use the API with the `leaderboardID` from the leaderboard bucket that was attributed to that userId (ownerId in this case, unless I’m misunderstanding or you have a different bucket implementation).

Just for some clarification, the `ListLeaderboardRecords` will list all records of a leaderboard, and optionally takes a list of `ownerIDs` to also return those specific records. The order depends on the leaderboard sort order when created.

`ListLeaderboardRecordsAroundOwnerAsync` is to get the records around the target ownerId, and then optionally navigate up or down from there using a cursor (which essentially becomes the same as a invoking `ListLeaderboardRecords` with a cursor).

`leaderboardRecordsListCursorFromRank` is a utility function that can be used to build a cursor to then use with `ListLeaderboardRecords` to list the records after that rank.

---

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [June 17, 2024, 10:08pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/5 "2024-06-17T22:08:43Z")

</div>

OK seem like i have some something misunderstand about the bucket leaderboard, let me make example base on my understanding

leaderboader test  
global 10 player and bucket to 3  
p0 bucket is p7,p8,p9  
p1 bucket is p5,p6,p8  
…  
p5 bucket is p0,p1,p9

global ranking is

p0,p1,p2,p3,p4,p5,p6,p7,p8,p9

now when player open the leaderboard, we want to show the current play and others around him,such as  
when p0 open game,will see p0 p7. rank 1,2  
p1 open to see p1,p5,rank 1,2 and  
p5 opne to see p1,p5,p9. rank is 2.3.4

if i use p5 as owner id to get around,will it return p4,p5,p6? but p4 and p6 not in bucket of p5,  
meanwhile the rank in record is golbal rank right?

if yes how we can get p1,p5,p9 directly without get full records of bucket of p5?

the real eamxple bucket may bigger such as 1000 player

---

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [June 18, 2024, 8:39am UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/6 "2024-06-18T08:39:42Z")

</div>

> If using bucketed leaderboards you should use the API with the `leaderboardID` from the leaderboard bucket that was attributed to that userId (ownerId in this case, unless I’m misunderstanding or you have a different bucket implementation).

Do you mean the bucket leaderboard is an independent Nakama leaderboard? the doc suggests only one leaderboard and bucket for each player with selected players as a view on the leaderboard. right

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 18, 2024, 5:08pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/7 "2024-06-18T17:08:23Z")

</div>

@mengxin you’re right, same leaderboard but different player buckets - in which case the ranks you should recompute based on the ordering of the results from the players in the bucket and disregard their actual ranks in the global leaderboard.

So if you have:  
p0 bucket is p0,p7,p8,p9

You should fetch p0,p7,p8,p9 using the ownerIds param in `leaderboardRecordsList` and just order them and rank them relative to the other players in the bucket.

The players shouldn’t be aware of their rank on their global leaderboard but instead compete with players in their own bucket.

Our [Hiro](https://heroiclabs.com/hiro/) framework handles all of this for you ;).

---

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [June 19, 2024, 2:30am UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/8 "2024-06-19T02:30:29Z")

</div>

thanks explaination. seem like if bucket size is big such as1000 to 10000, better to create separate leaderboard better.

btw may i ask hiro is not free right? seem like no price about it, only support with cloud solution?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 19, 2024, 12:34pm UTC](https://forum.heroiclabs.com/t/listleaderboardrecords-aroundownerasync-or-listtournamentrecords-aroundownerasync-support-bucket/5362/9 "2024-06-19T12:34:29Z")

</div>

Hiro is a licensed product and it can be used outside of Heroic Cloud. Please contact [sales@heroiclabs.com](mailto:sales@heroiclabs.com) if you’d like to know more.
