Stay organized with collectionsSave and categorize content based on your preferences.
Job search requests can include a commute time filter that restricts returned
jobs to those within a specified travel time from a start point.
Results include the estimated commute time in seconds for matched jobs.
Specific commute time search
To return jobs within a specific commute time, send ajobs.searchrequest and include aCommuteFilterobject in theJobQuery.commuteFilterfield. Cloud Talent Solution uses the job'saddressto calculate the commute time to that job. When a detailed address is not
provided Cloud Talent Solution attempts to infer the actual street address of the
job.
publicstaticvoidcommuteSearch(StringcompanyName)throwsIOException,InterruptedException{// Make sure to set the requestMetadata the same as the associated search requestRequestMetadatarequestMetadata=newRequestMetadata()// Make sure to hash your userID.setUserId("HashedUserId")// Make sure to hash the sessionID.setSessionId("HashedSessionID")// Domain of the website where the search is conducted.setDomain("www.google.com");JobQueryjobQuery=newJobQuery().setCommuteFilter(newCommuteFilter().setRoadTraffic("TRAFFIC_FREE").setCommuteMethod("TRANSIT").setTravelDuration("1000s").setStartCoordinates(newLatLng().setLatitude(37.422408).setLongitude(-122.085609)));if(companyName!=null){jobQuery.setCompanyNames(Arrays.asList(companyName));}SearchJobsRequestsearchJobsRequest=newSearchJobsRequest().setJobQuery(jobQuery).setRequestMetadata(requestMetadata).setJobView("JOB_VIEW_FULL").setRequirePreciseResultSize(true);SearchJobsResponseresponse=talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID,searchJobsRequest).execute();Thread.sleep(1000);System.out.printf("Search jobs for commute results: %s\n",response);}
// commuteSearch searches for jobs within commute filter.funccommuteSearch(wio.Writer,projectID,companyNamestring)(*talent.SearchJobsResponse,error){ctx:=context.Background()client,err:=google.DefaultClient(ctx,talent.CloudPlatformScope)iferr!=nil{returnnil,fmt.Errorf("google.DefaultClient: %w",err)}// Create the jobs service client.service,err:=talent.New(client)iferr!=nil{returnnil,fmt.Errorf("talent.New: %w",err)}jobQuery:=&talent.JobQuery{CommuteFilter:&talent.CommuteFilter{RoadTraffic:"TRAFFIC_FREE",CommuteMethod:"TRANSIT",TravelDuration:"1000s",StartCoordinates:&talent.LatLng{Latitude:37.422408,Longitude:-122.085609,},},}ifcompanyName!=""{jobQuery.CompanyNames=[]string{companyName}}parent:="projects/"+projectIDreq:=&talent.SearchJobsRequest{// Make sure to set the RequestMetadata the same as the associated// search request.RequestMetadata:&talent.RequestMetadata{// Make sure to hash your userID.UserId:"HashedUsrId",// Make sure to hash the sessionID.SessionId:"HashedSessionId",// Domain of the website where the search is conducted.Domain:"www.googlesample.com",},// Set the actual search term as defined in the jobQuery.JobQuery:jobQuery,// Set the search mode to a regular search.SearchMode:"JOB_SEARCH",RequirePreciseResultSize:true,}resp,err:=service.Projects.Jobs.Search(parent,req).Do()iferr!=nil{returnnil,fmt.Errorf("failed to search for jobs with commute filter: %w",err)}returnresp,nil}
# project_id = "Id of the project"# commute_method = "The method of transportation for which to calculate the commute time"# travel_duration = "The maximum travel time in seconds"# start_coordinates = "The latitude and longitude of the location from which to calculate the commute time"require"google/apis/jobs_v3"jobs=Google::Apis::JobsV3talent_solution_client=jobs::CloudTalentSolutionService.new# @see https://developers.google.com/identity/protocols/application-default-credentials#callingrubytalent_solution_client.authorization=Google::Auth.get_application_default("https://www.googleapis.com/auth/jobs")# Make sure to set the request_metadata the same as the associated search requestrequest_metadata=jobs::RequestMetadata.newuser_id:"HashedUserId",session_id:"HashedSessionId",domain:"www.google.com"# Set location filtercommute_filter=jobs::CommuteFilter.newroad_traffic:"TRAFFIC_FREE",commute_method:commute_method,travel_duration:travel_duration,start_coordinates:start_coordinates# Perform a search for analyst related jobssearch_jobs_request=jobs::SearchJobsRequest.newrequest_metadata:request_metadata,job_query:(jobs::JobQuery.newcommute_filter:commute_filter),job_view:"JOB_VIEW_FULL",require_precise_result_size:truesearch_jobs_response=talent_solution_client.search_jobsproject_id,search_jobs_requestputssearch_jobs_response.to_jsonsearch_jobs_response
Required fields
commuteMethod: The method of transportation for which to calculate the
commute time. Options areDRIVINGandTRANSIT.
All versions since V3p1beta1 will also includeWALKINGandCYCLINGtransit modes.Walking and cycling routes may not reflect real-world conditions such as construction
or include clear walking or cycling paths. These responses will includewarningsin
the returned result which you must display to your users.
travelDuration: The maximum travel time in seconds. The maximum allowed
value is3600s(one hour). Format is123s.
startCoordinates: The latitude and longitude of the location from which to
calculate the commute time. Accepts aLatLngobject.
Optional fields
allowImpreciseAddresses: "Precise" addresses are defined as either street level
addresses or GPS coordinates. IfallowImpreciseAddressesis set totrue, jobs
with "imprecise" addresses (city, state, or country only) may also be returned.
For city level and coarser level addresses, text matching is used. If this field is
set tofalseor is not specified, only jobs that include precise addresses are
returned by commute search.
roadTraffic: Specifies the traffic density to use when calculating commute
time. Options areTRAFFIC_FREEorBUSY_HOUR. Must not be present ifdepartureHourLocalis specified.
departureTime: The departure hour to use to calculate traffic impact.
Accepts an integer between 0 and 23, representing the hour in the timezone
of thestartLocation. Must not be present ifroadTrafficis specified.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,[]]