I have an FQL that organizes my documents by score of several players with their respective teams. As in the example below.
q.Map(
q.Paginate(
q.Match(
q.Index('statistics_highest_scorers_by_season_id'),
5 // seasonId
),
{size: 30, after}
),
q.Lambda(
["score", "player_id", "team_id"],
{
player: q.Select(
'data',
q.Get(
q.Match(
q.Index('players_by_season_and_player'),
5,
q.Var('player_id')
)
)
),
team: {
name: q.Select(['data', 'name'],
q.Get(q.Match( q.Index('team_by_season_and_team_id'), 5, q.Var('team_id')))
),
image: q.Select(['data', 'image'],
q.Get(q.Match( q.Index('team_by_season_and_team_id'), 5, q.Var('team_id')))
)
},
score: q.Var("score"),
}
)
)
My “after” comes from another variable that is inserted there. It is not a reference, but a score from the sorted list (which I found strange, but apparently in my list in descending order where the first field is the score, I have to page using this information).
But the real point of my question is about a next step I need. This FQL so far is working (I just don’t know if it’s the best method).
I now need to get a player from this list with his score and the 2 players with scores next to him in this ranking (the one before in the ranking and the one after) and not the whole list.
Is there a more correct way to do this without having to bring all the information at once and map it in javascript.