buildurl should account for query