Changed getByQuery to accept a wider range of rawQuery options