Fix logic in jobs index querying
Small refactors in jobs index query