I know a lot has been written on this issue already but I found no clear answer.

Here it is:

With the Voting API and another module such as Fivestars or Rate, how do you rank the results within results?

Let me give an example: With views, I can have a proper display of all the nodes that have received, say, 5 stars followed by all those that received 4 stars and so on. So the nodes are grouped properly.

But to rank the nodes within each group (i.e.: The 5 star node that have received the most number of votes being displayed first followed by the 5 star node that come in second position, etc. How does one set that in views?

At the present, I have no sorting within each star group so a node that has received one 5 star vote comes before one that has received three 5 stars, followed by one with that received two (1-3-2.)

My setting are:

Relationships: Content: Vote results -- Value type: No filtering -- Aggregation function: Average vote. Sort criteria: Vote results: Value (desc.)

It looks like I need an additional sorting mechanism but i can't find it.

Any one has an answer for this? I am not a programmer but a site builder. :)

Thank you. :)

1 Answer 1


Never mind I think I finally found the solution:

In addition to the settings above, I added a second relationships: Content: Vote results. It's the same relationship as before but instead of "Average vote" in the Aggregate function, I have "Number of votes." So as to avoid confusion, I also changed the identifier to: "Vote results (rank in group)"

So, I have two relationships, almost identical except for the Aggregate functions.

Then, in addition to the sort criteria described above, I added the same criteria again except that I chose the second relationship ("Vote results (rank in group)") instead. Order is also descending.

And that gave me the desired results: Nodes are properly ranked within the groups.

You can test this by enabling Text to display under the stars: Both user's and average vote in the rating field.


Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.