What I’m trying to do is get the score for each post based on the number of followers of the author who liked that post. Specifically, I’m using the count function with the ~liked predicate, filtered by the UID of the follower.
so with following query. I can get one the score I want about one specific post.
However, However, I’m not just looking for the score of one post. I want to calculate the score for every post that I select. Is it possible? Thanks for your help.
Sorry the delay. Lots going on. Well, this is not possible. I mean, The best and precise way of checking the scores is individually. If you use the same variable for a wide query(mean, looking for all posts and trying to aggregate for each) this wont work. I have an issue to introduce “foreach” and that would solve that problem. As Dgraph would apply the same query, but individually. That means for each node found in the root query Dgraph would isolate the variables.
Until there you have to narrow your query.
Cheers.
PS. Dgraph queries are “mapped based”. You may be able to aggregate each of the posts using the same structure(it depends of the levels too). But the Root needs to be the same map as the other blocks.
Share some JSON examples of your data and I can explore it for you.