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 collections which are actually queried!