Add sorted queries for all entities with a given attribute, and make Indexes iterate in the correct direction