indexes query, adding tests