기본 위치 검색
Java
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
/** Basic location Search */
public static void basicLocationSearch(String companyName, String location, double distance)
throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata =
new RequestMetadata()
// Make sure to hash the userID
.setUserId("HashedUserId")
// Make sure to hash the sessionID
.setSessionId("HashedSessionID")
// Domain of the website where the search is conducted
.setDomain("www.google.com");
LocationFilter locationFilter =
new LocationFilter().setAddress(location).setDistanceInMiles(distance);
JobQuery jobQuery = new JobQuery().setLocationFilters(Arrays.asList(locationFilter));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest request =
new SearchJobsRequest()
.setRequestMetadata(requestMetadata)
.setJobQuery(jobQuery)
.setSearchMode("JOB_SEARCH");
SearchJobsResponse response =
talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, request).execute();
Thread.sleep(1000);
System.out.printf("Basic location search results: %s", response);
}
Python
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
def basic_location_search(client_service, company_name, location, distance):
request_metadata = {
"user_id": "HashedUserId",
"session_id": "HashedSessionId",
"domain": "www.google.com",
}
location_filter = {"address": location, "distance_in_miles": distance}
job_query = {"location_filters": [location_filter]}
if company_name is not None:
job_query.update({"company_names": [company_name]})
request = {
"job_query": job_query,
"request_metadata": request_metadata,
"search_mode": "JOB_SEARCH",
}
response = (
client_service.projects().jobs().search(parent=parent, body=request).execute()
)
print(response)
키워드 및 위치 검색
Java
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
/** Keyword location Search */
public static void keywordLocationSearch(
String companyName, String location, double distance, String keyword)
throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata =
new RequestMetadata()
// Make sure to hash the userID
.setUserId("HashedUserId")
// Make sure to hash the sessionID
.setSessionId("HashedSessionID")
// Domain of the website where the search is conducted
.setDomain("www.google.com");
LocationFilter locationFilter =
new LocationFilter().setAddress(location).setDistanceInMiles(distance);
JobQuery jobQuery =
new JobQuery().setQuery(keyword).setLocationFilters(Arrays.asList(locationFilter));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest request =
new SearchJobsRequest()
.setRequestMetadata(requestMetadata)
.setJobQuery(jobQuery)
.setSearchMode("JOB_SEARCH");
SearchJobsResponse response =
talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, request).execute();
Thread.sleep(1000);
System.out.printf("Keyword location search results: %s", response);
}
Python
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
def keyword_location_search(client_service, company_name, location, distance, keyword):
request_metadata = {
"user_id": "HashedUserId",
"session_id": "HashedSessionId",
"domain": "www.google.com",
}
location_filter = {"address": location, "distance_in_miles": distance}
job_query = {"location_filters": [location_filter], "query": keyword}
if company_name is not None:
job_query.update({"company_names": [company_name]})
request = {
"job_query": job_query,
"request_metadata": request_metadata,
"search_mode": "JOB_SEARCH",
}
response = (
client_service.projects().jobs().search(parent=parent, body=request).execute()
)
print(response)
Go
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
// keywordLocationSearch searches for jobs with given keyword and within the
// distance of given location.
func keywordLocationSearch(w io.Writer, projectID, companyName, location string, distance float64, keyword 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{
LocationFilters: []*talent.LocationFilter{
{
Address: location,
DistanceInMiles: distance,
},
},
Query: keyword,
}
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",
}
resp, err := service.Projects.Jobs.Search(parent, req).Do()
if err != nil {
return nil, fmt.Errorf("failed to search for jobs with keyword %q in location %v within %f miles: %w", keyword, location, distance, err)
}
fmt.Fprintln(w, "Jobs:")
for _, j := range resp.MatchingJobs {
fmt.Fprintf(w, "\t%q\n", j.Job.Name)
}
return resp, nil
}
address
은 실제 채용정보 위치를 나타내는 문자열입니다. 상세 주소일 수도 있고, 국가 또는 그 이하 단위일 수도 있습니다. 예를 들면 '123 Main Street, Anytown, WA, USA' 또는 단순히 'USA'일 수 있습니다.distanceInMiles
:name
또는latLng
로부터 검색할 거리(마일)입니다. 기본값은 20입니다. 최대는 5,000입니다.name
의 값이 상세 주소인 경우 해당 단일 지점의 설정된 distanceInMiles 내의 채용정보가 반환됩니다.name
의 값이 동/읍/면 또는 시인 경우, 동/읍/면/시 중앙의 설정된 distanceInMiles 내의 채용정보가 반환됩니다. 지역 또는 도시 내에 있는 모든 채용정보를 반환하려면distanceInMiles
를 0으로 설정하세요. distanceInMiles가 0보다 큰 경우에 적용되는 검색 반경은 지역 또는 도시의 지리적 경계에 요청에 설정된 distanceInMiles를 더한 값입니다. 지리적 경계는 Google Maps Geocoding API를 사용하여 추정됩니다.name
값이 '베이 지역' 또는 '실리콘 밸리'와 같은 구어로 된 영역인 경우 적용된 검색 반경은 해당 지역의 추정된 지리적 경계에 요청에 설정된 distanceInMiles을 더한 거리입니다.name
의 값이 주/도 또는 국가인 경우distanceInMiles
는 무시되고 지정된 주/도 또는 국가 내에 있는 채용정보가 반환됩니다.
기본 위치(도시 수준 위치 및 출력만 포함)
Java
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
/** City location Search */
public static void cityLocationSearch(String companyName, String location)
throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata =
new RequestMetadata()
// Make sure to hash the userID
.setUserId("HashedUserId")
// Make sure to hash the sessionID
.setSessionId("HashedSessionID")
// Domain of the website where the search is conducted
.setDomain("www.google.com");
LocationFilter locationFilter = new LocationFilter().setAddress(location);
JobQuery jobQuery = new JobQuery().setLocationFilters(Arrays.asList(locationFilter));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest request =
new SearchJobsRequest()
.setRequestMetadata(requestMetadata)
.setJobQuery(jobQuery)
.setSearchMode("JOB_SEARCH");
SearchJobsResponse response =
talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, request).execute();
Thread.sleep(1000);
System.out.printf("City locations search results: %s", response);
}
Python
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
def city_location_search(client_service, company_name, location):
request_metadata = {
"user_id": "HashedUserId",
"session_id": "HashedSessionId",
"domain": "www.google.com",
}
location_filter = {"address": location}
job_query = {"location_filters": [location_filter]}
if company_name is not None:
job_query.update({"company_names": [company_name]})
request = {
"job_query": job_query,
"request_metadata": request_metadata,
"search_mode": "JOB_SEARCH",
}
response = (
client_service.projects().jobs().search(parent=parent, body=request).execute()
)
print(response)
Go
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
// cityLocationSearch searches for jobs in the same city of given location.
func cityLocationSearch(w io.Writer, projectID, companyName, location 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{
LocationFilters: []*talent.LocationFilter{
{
Address: location,
},
},
}
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",
}
resp, err := service.Projects.Jobs.Search(parent, req).Do()
if err != nil {
return nil, fmt.Errorf("failed to search for jobs with city location %s: %w", location, err)
}
fmt.Fprintln(w, "Jobs:")
for _, j := range resp.MatchingJobs {
fmt.Fprintf(w, "\t%q\n", j.Job.Name)
}
return resp, nil
}
여러 위치
검색어에 여러 위치와 여러 반경을 전달하면 모든 위치에 최대 반경이 적용됩니다. 채용정보 하나의 위치는 최대 5개로 제한됩니다.
Java
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
/** Multiple locations Search */
public static void multiLocationsSearch(
String companyName, String location1, double distance1, String location2)
throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata =
new RequestMetadata()
// Make sure to hash the 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()
.setLocationFilters(
Arrays.asList(
new LocationFilter().setAddress(location1).setDistanceInMiles(distance1),
new LocationFilter().setAddress(location2)));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest request =
new SearchJobsRequest()
.setRequestMetadata(requestMetadata)
.setJobQuery(jobQuery)
.setSearchMode("JOB_SEARCH");
SearchJobsResponse response =
talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, request).execute();
Thread.sleep(1000);
System.out.printf("Multiple locations search results: %s", response);
}
Python
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
def multi_locations_search(
client_service, company_name, location1, distance1, location2
):
request_metadata = {
"user_id": "HashedUserId",
"session_id": "HashedSessionId",
"domain": "www.google.com",
}
location_filter1 = {"address": location1, "distance_in_miles": distance1}
location_filter2 = {"address": location2}
job_query = {"location_filters": [location_filter1, location_filter2]}
if company_name is not None:
job_query.update({"company_names": [company_name]})
request = {
"job_query": job_query,
"request_metadata": request_metadata,
"search_mode": "JOB_SEARCH",
}
response = (
client_service.projects().jobs().search(parent=parent, body=request).execute()
)
print(response)
Go
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
// multiLocationsSearch searches for jobs that fall in the distance of any given
// locations.
func multiLocationsSearch(w io.Writer, projectID, companyName, location, location2 string, distance float64) (*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{
LocationFilters: []*talent.LocationFilter{
{
Address: location,
DistanceInMiles: distance,
},
{
Address: location2,
DistanceInMiles: distance,
},
},
}
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",
}
resp, err := service.Projects.Jobs.Search(parent, req).Do()
if err != nil {
return nil, fmt.Errorf("Failed to search for jobs with multi locations %s and %s within %f miles, Err: %w", location, location2, distance, err)
}
fmt.Fprintln(w, "Jobs:")
for _, j := range resp.MatchingJobs {
fmt.Fprintf(w, "\t%q\n", j.Job.Name)
}
return resp, nil
}
enableBroadening 플래그 설정
enableBroadening 플래그를 사용하면 위치 및 채용정보 카테고리의 제한을 완화하여 반환되는 결과의 수를 늘릴 수 있습니다.
Java
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
/** Broadening location Search */
public static void broadeningLocationsSearch(String companyName, String location)
throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata =
new RequestMetadata()
// Make sure to hash the 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().setLocationFilters(Arrays.asList(new LocationFilter().setAddress(location)));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest request =
new SearchJobsRequest()
.setRequestMetadata(requestMetadata)
.setJobQuery(jobQuery)
.setEnableBroadening(true)
.setSearchMode("JOB_SEARCH");
SearchJobsResponse response =
talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, request).execute();
Thread.sleep(1000);
System.out.printf("Broadening locations search results: %s", response);
}
Python
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
def broadening_location_search(client_service, company_name, location):
request_metadata = {
"user_id": "HashedUserId",
"session_id": "HashedSessionId",
"domain": "www.google.com",
}
location_filter = {"address": location}
job_query = {"location_filters": [location_filter]}
if company_name is not None:
job_query.update({"company_names": [company_name]})
request = {
"job_query": job_query,
"request_metadata": request_metadata,
"search_mode": "JOB_SEARCH",
"enable_broadening": True,
}
response = (
client_service.projects().jobs().search(parent=parent, body=request).execute()
)
print(response)
Go
Cloud Talent Solution 클라이언트 설치 및 생성에 대한 자세한 내용은 Cloud Talent Solution 클라이언트 라이브러리를 참조하세요.
// broadeningLocationSearch searches for jobs with a broadening area of given
// location.
func broadeningLocationSearch(w io.Writer, projectID, companyName, location 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{
LocationFilters: []*talent.LocationFilter{
{
Address: location,
},
},
}
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",
EnableBroadening: true,
}
resp, err := service.Projects.Jobs.Search(parent, req).Do()
if err != nil {
return nil, fmt.Errorf("failed to search for jobs with broadening location %v: %w", location, err)
}
fmt.Fprintln(w, "Jobs:")
for _, j := range resp.MatchingJobs {
fmt.Fprintf(w, "\t%q\n", j.Job.Name)
}
return resp, nil
}