Range index: use only queried collections to determine if index exists

Queries using fields looked at all index configurations to determine which index should be used. This causes confusion if there are conflicting index definitions in the database. Limit the lookup to those collection which are actually queried!