통근 조건 검색(v3)

취업정보 검색 요청에는 출발 지점부터 특정 이동 시간 이내에 포함되는 취업정보만 반환되도록 제한하는 통근 시간 필터가 포함될 수 있습니다. 결과에는 일치하는 채용정보의 예상 통근 시간이 초 단위로 포함됩니다.

특정 통근 시간 이내의 취업정보를 반환하려면 jobs.search 요청을 보내면서 JobQuery.commuteFilter 필드에 CommuteFilter 객체를 포함시켜야 합니다. Cloud Talent Solution은 취업정보의 주소를 사용하여 근무처까지 통근하는 데 걸리는 시간을 계산합니다. 상세 주소가 제공되지 않은 경우 Cloud Talent Solution은 근무처의 실제 주소를 유추하려고 시도합니다.

Java

Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.


public static void commuteSearch(String companyName) throws IOException, InterruptedException {
  // Make sure to set the requestMetadata the same as the associated search request
  RequestMetadata requestMetadata =
      new RequestMetadata()
          // 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");
  JobQuery jobQuery =
      new JobQuery()
          .setCommuteFilter(
              new CommuteFilter()
                  .setRoadTraffic("TRAFFIC_FREE")
                  .setCommuteMethod("TRANSIT")
                  .setTravelDuration("1000s")
                  .setStartCoordinates(
                      new LatLng().setLatitude(37.422408).setLongitude(-122.085609)));
  if (companyName != null) {
    jobQuery.setCompanyNames(Arrays.asList(companyName));
  }

  SearchJobsRequest searchJobsRequest =
      new SearchJobsRequest()
          .setJobQuery(jobQuery)
          .setRequestMetadata(requestMetadata)
          .setJobView("JOB_VIEW_FULL")
          .setRequirePreciseResultSize(true);
  SearchJobsResponse response =
      talentSolutionClient
          .projects()
          .jobs()
          .search(DEFAULT_PROJECT_ID, searchJobsRequest)
          .execute();
  Thread.sleep(1000);
  System.out.printf("Search jobs for commute results: %s\n", response);
}

Python

Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.

def commute_search(client_service, company_name):
    request_metadata = {
        "user_id": "HashedUserId",
        "session_id": "HashedSessionId",
        "domain": "www.google.com",
    }
    start_location = {"latitude": 37.422408, "longitude": -122.085609}
    commute_preference = {
        "road_traffic": "TRAFFIC_FREE",
        "commute_method": "TRANSIT",
        "travel_duration": "1000s",
        "start_coordinates": start_location,
    }
    job_query = {"commute_filter": commute_preference}
    if company_name is not None:
        job_query.update({"company_names": [company_name]})
    request = {
        "job_query": job_query,
        "request_metadata": request_metadata,
        "job_view": "JOB_VIEW_FULL",
        "require_precise_result_size": True,
    }
    response = (
        client_service.projects().jobs().search(parent=parent, body=request).execute()
    )
    print(response)

Go

Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.


// commuteSearch searches for jobs within commute filter.
func commuteSearch(w io.Writer, projectID, companyName string) (*talent.SearchJobsResponse, error) {
	ctx := context.Background()

	client, err := google.DefaultClient(ctx, talent.CloudPlatformScope)
	if err != nil {
		return nil, fmt.Errorf("google.DefaultClient: %w", err)
	}
	// Create the jobs service client.
	service, err := talent.New(client)
	if err != nil {
		return nil, 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,
			},
		},
	}
	if companyName != "" {
		jobQuery.CompanyNames = []string{companyName}
	}

	parent := "projects/" + projectID
	req := &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()
	if err != nil {
		return nil, fmt.Errorf("failed to search for jobs with commute filter: %w", err)
	}
	return resp, nil
}

필수 입력란

  • commuteMethod: 통근 시간을 계산할 교통 수단입니다. 옵션은 DRIVINGTRANSIT입니다. V3p1beta1 이후의 모든 버전에는 WALKINGCYCLING이라는 교통수단도 포함됩니다. 도보 및 자전거 경로는 실제 조건(예: 공사 중)을 반영하지 않거나 불분명한 경로를 포함할 수 있습니다. 이러한 응답에는 사용자에게 표시해야 하는 반환된 결과의 warnings가 포함됩니다.

  • travelDuration: 최대 이동 시간(초)입니다. 최대 3600s(1시간)까지 허용됩니다. 형식은 123s입니다.

  • startCoordinates: 통근 시간을 계산하기 시작할 출발지의 위도와 경도입니다. LatLng 객체를 승인합니다.

선택 필드

  • allowImpreciseAddresses: 'precise' 주소는 도로명 주소 또는 GPS 좌표로 정의됩니다. allowImpreciseAddressestrue로 설정하면 'imprecise' 주소(시, 도 또는 국가만)가 있는 채용정보도 반환될 수 있습니다. 도시 수준 및 더 큰 단위의 주소의 경우 텍스트 일치가 사용됩니다. 이 필드를 false로 설정하거나 지정하지 않으면 통근 조건 검색에서 precise 주소를 포함하는 취업정보만 반환합니다.
  • roadTraffic: 통근 시간을 계산할 때 사용할 교통량을 지정합니다. 옵션은 TRAFFIC_FREE 또는 BUSY_HOUR입니다. departureHourLocal을 지정한 경우 이 필드가 없어야 합니다.

  • departureTime: 교통 상황을 계산하는 데 사용할 출발 시간입니다. startLocation의 시간대를 기준으로 시간을 나타내는 0~23 범위의 정수를 사용합니다. roadTraffic을 지정한 경우 이 필드가 없어야 합니다.