Maximumscore filtering for groups improved to support different types of sorting