Add weighted average and the related cache

Weighted average can be used for displaying e.g.,  average rating and its cache can be used for ordering by average rating.

Also modified the weighted score cache spec in order to take vote weight into account.