transform the query in the map version