refactor getQuery
remove incorrect query constraint