Missing rank information for specific user_id while using ListLeaderboardRecords

I have used ListLeaderboardRecords and ListLeaderboardRecordsAroundOwner to get information about the current users rank in a specific leaderboard. That worked fine in Nakama 3.13 as the rank was part of the result (e.g. in owner records).

However, I recently upgraded to 3.23 and now it seems that the rank information is only available for the records - not the ownerRecords - in the result from ListLeaderboardRecords.

E.g.

{
  "records": [
    {
      "leaderboardId": "global_rank_leaderboard",
      "ownerId": "218dfebe-7803-4f30-8eb9-65c5944adab5",
      "username": "cool_jesse",
      "score": "799",
      "numScore": 1,
      "metadata": "{}",
      "createTime": "2024-08-15T14:12:21Z",
      "updateTime": "2024-08-15T14:12:21Z",
      "rank": "1",
      "maxNumScore": 1000000
    }
  ],
  "ownerRecords": [
    {
      "leaderboardId": "global_rank_leaderboard",
      "ownerId": "418e86e2-7eb5-4f48-982a-36447aed40ca",
      "username": "fFSTwmTQQJ",
      "score": "66",
      "numScore": 2,
      "metadata": "{}",
      "createTime": "2024-08-15T14:12:51Z",
      "updateTime": "2024-08-15T14:13:02Z",
      "maxNumScore": 1000000
    }
  ],
  "nextCursor": "_4B_AwEBG2xlYWRlcmJvYXJkUmVjb3JkTGlzdEN1cnNvcgH_gAABBwEGSXNOZXh0AQIAAQ1MZWFkZXJib2FyZElkAQwAAQpFeHBpcnlUaW1lAQQAAQVTY29yZQEEAAEIU3Vic2NvcmUBBAABB093bmVySWQBDAABBFJhbmsBBAAAAEr_gAEBARdnbG9iYWxfcmFua19sZWFkZXJib2FyZAL-Bj4CJDIxOGRmZWJlLTc4MDMtNGYzMC04ZWI5LTY1YzU5NDRhZGFiNQECAA=="
}

How can I now obtain the current rank of a user within the leaderboard? Is this even possible? Or was this information dropped accidentially in the recent Nakama version? Any help is appreciated, thanks!

Ok, answering this myself (at least parts of it):

From the release notes I found

Add leaderboard create function parameter to enable or disable ranks.

However, in the docs for (e.g. lua) leaderboard_create function, this parameter is not mentioned at all. Adding a true as a last parameter, after the metadata, seems to work fine.

But I don’t understand why this option seems to default to false, this seems to have changed the behavior when comparing with older versions, right?

Hello @0xbeefbeef, the default was changed as the rank cache can have performance and memory usage implications at scale, so we decided to make it opt-in so that it’s not used when not needed.

Existing leaderboards are not affected, however for new ones you’ll need to explicitly set the enableRanks option to true going forward.

We’ll make sure to update the documentation soon.

Best.