Change trending queries to use aggregations (bug 1116898)