add ids query handling