Constructing URL from a query.