CAPEDWARF-174 Make sure DatastoreNeedIndexException is thrown only when query results are first accessed
CAPEDWARF-174 Fix logic when an index is required