UI에서 통근 조건 검색 구현(v3)

통근 조건 검색을 UI에 통합하면 구직자가 통근 시간으로 설정된 지리적 영역에 있는 채용정보를 검색할 수 있습니다. 통근 조건 검색은 사용자가 선택한 대중교통 모드와 사용자가 통근하는 시간대를 기반으로 통근 시간을 추정합니다.

  1. 통근 조건 검색을 구현하려면 먼저 Cloud Talent Solution이 UI에 연결되어야 합니다. 빠른 시작 가이드를 따라 Cloud Talent Solution을 설정하세요.

  2. 통근 조건 검색은 CTS 구현 시 사용자가 채용정보와 함께 업로드한 주소 데이터를 사용하여 통근 시간을 계산합니다. 기존 CTS UI에서 이 기능을 사용 설정하려면 jobs.search 요청을 전송하고 JobQuery.commuteFilter 필드에 CommuteFilter 객체를 포함합니다. commuteMethod, travelDuration, startCoordinates는 필수 필드입니다.

    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
    }
    

    Ruby

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

    # 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::JobsV3
    talent_solution_client = jobs::CloudTalentSolutionService.new
    # @see https://developers.google.com/identity/protocols/application-default-credentials#callingruby
    talent_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 request
    request_metadata = jobs::RequestMetadata.new user_id:    "HashedUserId",
                                                 session_id: "HashedSessionId",
                                                 domain:     "www.google.com"
    # Set location filter
    commute_filter = jobs::CommuteFilter.new road_traffic:      "TRAFFIC_FREE",
                                             commute_method:    commute_method,
                                             travel_duration:   travel_duration,
                                             start_coordinates: start_coordinates
    # Perform a search for analyst  related jobs
    search_jobs_request =
      jobs::SearchJobsRequest.new request_metadata:            request_metadata,
                                  job_query:                   (jobs::JobQuery.new commute_filter: commute_filter),
                                  job_view:                    "JOB_VIEW_FULL",
                                  require_precise_result_size: true
    search_jobs_response = talent_solution_client.search_jobs project_id, search_jobs_request
    puts search_jobs_response.to_json
    search_jobs_response

UI에 대한 권장사항

  1. Cloud Talent Solution에서는 검색 기준으로 거리(CTS 위치 필터 사용)와 통근 시간을 함께 사용할 수 없습니다. 구직자가 두 가지 옵션을 모두 이용할 수 있게 하려면 탭이 두 개인 방식 또는 유사한 방법을 사용하세요.

  2. 구직자가 통근 조건 검색을 요청하면 백엔드에서 통근 필터에 관련 정보를 채우고 일반 검색 요청과 마찬가지로 API를 호출하도록 애플리케이션의 프런트 엔드를 수정합니다.

  3. 다음과 같은 새로 추가된 항목을 UI에 포함합니다.

    • 거리 검색인지 통근 조건 검색인지 선택하는 옵션. 예를 들어 검색 UI가 아래 샘플과 유사할 수 있습니다.

    • 통근 방법 옵션의 드롭다운 메뉴

    • 교통 상태를 조정하는 옵션

    • 총 이동 시간(지원되는 최대 이동 시간은 60분)

    • 통근 시작 시간

  4. 그러면 구직자에게 정보를 표시하는 데 API에서 반환되는 통근 시간 정보가 사용됩니다. 지정한 통근 시간 지역 내에 있는 적절한 채용정보만 결과 목록에 반환됩니다. 이 지역 내에서 반환되는 채용정보의 순서와 개수를 조정하는 방법에 대한 설명은 채용정보 검색 권장사항 문서를 참조하세요.

Maps API를 이용하여 CTS API에서 반환된 통근 시간 정보를 기반으로 지도를 생성하고 이 지도를 구직자에게 반환되는 결과에 포함할 수 있습니다. Maps API 제품군에는 지도 표시와 관련된 몇 가지 옵션이 있습니다. 다른 Maps API 옵션보다 효과적인 Maps API 옵션이 몇 가지 있습니다. 예를 들어 Google 지도 자바스크립트 히트맵 시각화마커 클러스터링을 함께 사용하면 구직자가 설정한 통근 정보를 기준으로 선별된 지역 내에 있는 구직자에게 반환되는 채용정보를 효율적으로 시각화할 수 있습니다. 이와 반대로 경로 모드는 검색 요청에 반환되는 모든 채용정보를 표시하지 않으며 권장 옵션이 아닙니다.

통근 조건에 기반한 검색 구현 방법에 대한 자세한 내용은 통근 조건 검색 안내 가이드를 참조하세요.