Refine query to depend on label rather than priority