sort matches by (score, filename) to ensure consistency.