switch query if no filter is provided