커스텀 순위

커스텀 순위 기능을 통해 자체적인 비즈니스 로직을 도입하여 Cloud Talent Solution에서 반환되는 채용정보 순위를 제어할 수 있습니다. 사이트에서 검색하는 구직자는 언제나처럼 검색어 및 기타 필터를 설정할 수 있으며 검색 요청에 순위 표현식을 추가할 수 있습니다. Cloud Talent Solution은 구직자가 정의한 쿼리에 대한 관련 채용정보를 결정하고 커스텀 순위 표현식을 기반으로 결과의 순위를 지정합니다. 순위가 매겨진 이 목록이 회사에 반환되고, 회사는 이것을 구직자에게 표시할 수 있습니다. 커스텀 순위 구현에 대한 동영상 튜토리얼도 사용 가능합니다.

이점

커스텀 순위를 통해 결과를 나열하는 방법을 제어할 수 있습니다. 커스텀 순위를 사용하면 커스텀 속성에 할당할 가중치를 정의할 수 있습니다. 가중치 및 커스텀 속성의 조합을 사용하여 반환되는 항목의 순서를 결정하기 위한 커스텀 순위 표현식을 만들 수 있습니다.

커스텀 순위는 기존 검색 서비스를 기반으로 합니다. 커스텀 속성의 고객 정의 조합에서 제공된 값을 활용합니다.

사용 사례

최종 사용자가 '소프트웨어 엔지니어'를 검색합니다. 귀하의 회사는 '소프트웨어 엔지니어'에 가중치를 줘서 반환 목록을 표시하려 합니다. 커스텀 순위를 사용하면 목록에 값을 지정하여 커스텀 순위 표현식에서 결정한 순서대로 최종 사용자에게 목록을 보여줄 수 있습니다.

예를 들어, 거의 동일한 두 개의 일자리 항목인데, 일자리 A가 일자리 B보다 클릭당 비용 (CPC) 값이 더 높다고 합시다. CPC 커스텀 속성의 순위를 가중치로 조정하는 방식으로 커스텀 순위를 이용해 일자리 A의 가시성을 높일 수 있습니다.

사용 방법

커스텀 순위는 +, -, *, /, (, ) 등의 수학적 연산자를 지합니다.

커스텀 속성의 필드와 이러한 수학적 연산자를 사용하여 커스텀 순위 표현식을 정의할 수 있습니다.

예를 들어 CPC 및 최신 상태라는 두 개의 커스텀 속성이 있다고 가정해 보겠습니다. 최신 상태란 채용정보가 게시된 이후로 지난 일 수입니다. CPC가 순위에 75% 반영되고 최신 상태는 25%가 반영되는 CPC 및 최신 상태별 일자리 순위를 매기려 한다고 할 때, 다음과 같이 커스텀 순위 표현식을 만들 수 있습니다.

(0.75*CPC) + (0.25 *Freshness)

코드 샘플

다음 예제에서는 두 가지 커스텀 속성 cpc_valuefreshness_value를 사용하여 커스텀 순위 표현식을 작성합니다. 커스텀 순위 표현식은 이렇게 됩니다: (cpc_value / 2) - freshness_value

Go

CTS용 클라이언트 라이브러리를 설치하고 사용하는 방법은 CTS 클라이언트 라이브러리를 참조하세요. 자세한 내용은 CTS Go API 참조 문서를 확인하세요.

CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"cloud.google.com/go/talent/apiv4beta1/talentpb"
)

// customRankingSearch searches for jobs based on custom ranking.
func customRankingSearch(w io.Writer, projectID, companyID string) error {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		return fmt.Errorf("taleng.NewJobClient: %w", err)
	}
	defer c.Close()

	// Construct a searchJobs request.
	req := &talentpb.SearchJobsRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		// Make sure to set the RequestMetadata the same as the associated
		// search request.
		RequestMetadata: &talentpb.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",
		},
		JobQuery: &talentpb.JobQuery{
			Companies: []string{fmt.Sprintf("projects/%s/companies/%s", projectID, companyID)},
		},
		// More info on customRankingInfo.
		// https://godoc.org/google.golang.org/genproto/googleapis/cloud/talent/v4beta1#SearchJobsRequest_CustomRankingInfo
		CustomRankingInfo: &talentpb.SearchJobsRequest_CustomRankingInfo{
			ImportanceLevel:   talentpb.SearchJobsRequest_CustomRankingInfo_EXTREME,
			RankingExpression: "(someFieldLong + 25) * 0.25",
		},
		OrderBy: "custom_ranking desc",
	}

	resp, err := c.SearchJobs(ctx, req)
	if err != nil {
		return fmt.Errorf("SearchJobs: %w", err)
	}

	for _, job := range resp.GetMatchingJobs() {
		fmt.Fprintf(w, "Job: %q\n", job.GetJob().GetName())
	}

	return nil
}

Java

CTS용 클라이언트 라이브러리를 설치하고 사용하는 방법은 CTS 클라이언트 라이브러리를 참조하세요. 자세한 내용은 CTS Java API 참조 문서를 확인하세요.

CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.cloud.talent.v4.Job;
import com.google.cloud.talent.v4.JobServiceClient;
import com.google.cloud.talent.v4.RequestMetadata;
import com.google.cloud.talent.v4.SearchJobsRequest;
import com.google.cloud.talent.v4.SearchJobsResponse;
import com.google.cloud.talent.v4.TenantName;
import java.io.IOException;

public class CustomRankingSearchJobs {

  public static void searchCustomRankingJobs() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    searchCustomRankingJobs(projectId, tenantId);
  }

  // Search Jobs using custom rankings.
  public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);
      String domain = "www.example.com";
      String sessionId = "Hashed session identifier";
      String userId = "Hashed user identifier";
      RequestMetadata requestMetadata =
          RequestMetadata.newBuilder()
              .setDomain(domain)
              .setSessionId(sessionId)
              .setUserId(userId)
              .build();
      SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel =
          SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME;
      String rankingExpression = "(someFieldLong + 25) * 0.25";
      SearchJobsRequest.CustomRankingInfo customRankingInfo =
          SearchJobsRequest.CustomRankingInfo.newBuilder()
              .setImportanceLevel(importanceLevel)
              .setRankingExpression(rankingExpression)
              .build();
      String orderBy = "custom_ranking desc";
      SearchJobsRequest request =
          SearchJobsRequest.newBuilder()
              .setParent(parent.toString())
              .setRequestMetadata(requestMetadata)
              .setCustomRankingInfo(customRankingInfo)
              .setOrderBy(orderBy)
              .build();
      for (SearchJobsResponse.MatchingJob responseItem :
          jobServiceClient.searchJobs(request).getMatchingJobsList()) {
        System.out.format("Job summary: %s%n", responseItem.getJobSummary());
        System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet());
        Job job = responseItem.getJob();
        System.out.format("Job name: %s%n", job.getName());
        System.out.format("Job title: %s%n", job.getTitle());
      }
    }
  }
}

Node.js

CTS용 클라이언트 라이브러리를 설치하고 사용하는 방법은 CTS 클라이언트 라이브러리를 참조하세요. 자세한 내용은 CTS Node.js API 참조 문서를 확인하세요.

CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


const talent = require('@google-cloud/talent').v4;

/**
 * Search Jobs using custom rankings
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenantd
 */
function sampleSearchJobs(projectId, tenantId) {
  const client = new talent.JobServiceClient();
  // Iterate over all elements.
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const domain = 'www.example.com';
  const sessionId = 'Hashed session identifier';
  const userId = 'Hashed user identifier';
  const requestMetadata = {
    domain: domain,
    sessionId: sessionId,
    userId: userId,
  };
  const importanceLevel = 'EXTREME';
  const rankingExpression = '(someFieldLong + 25) * 0.25';
  const customRankingInfo = {
    importanceLevel: importanceLevel,
    rankingExpression: rankingExpression,
  };
  const orderBy = 'custom_ranking desc';
  const request = {
    parent: formattedParent,
    requestMetadata: requestMetadata,
    customRankingInfo: customRankingInfo,
    orderBy: orderBy,
  };

  client
    .searchJobs(request)
    .then(responses => {
      for (const resources of responses) {
        for (const resource of resources.matchingJobs) {
          console.log(`Job summary: ${resource.jobSummary}`);
          console.log(`Job title snippet: ${resource.jobTitleSnippet}`);
          const job = resource.job;
          console.log(`Job name: ${job.name}`);
          console.log(`Job title: ${job.title}`);
        }
      }
    })
    .catch(err => {
      console.error(err);
    });
}

Python

CTS용 클라이언트 라이브러리를 설치하고 사용하는 방법은 CTS 클라이언트 라이브러리를 참조하세요. 자세한 내용은 CTS Python API 참조 문서를 확인하세요.

CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


from google.cloud import talent

def search_jobs(project_id, tenant_id):
    """Search Jobs using custom rankings"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    parent = f"projects/{project_id}/tenants/{tenant_id}"
    domain = "www.example.com"
    session_id = "Hashed session identifier"
    user_id = "Hashed user identifier"
    request_metadata = talent.RequestMetadata(
        domain=domain, session_id=session_id, user_id=user_id
    )
    importance_level = (
        talent.SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME
    )
    ranking_expression = "(someFieldLong + 25) * 0.25"
    custom_ranking_info = {
        "importance_level": importance_level,
        "ranking_expression": ranking_expression,
    }
    order_by = "custom_ranking desc"

    # Iterate over all results
    results = []
    request = talent.SearchJobsRequest(
        parent=parent,
        request_metadata=request_metadata,
        custom_ranking_info=custom_ranking_info,
        order_by=order_by,
    )
    for response_item in client.search_jobs(request=request).matching_jobs:
        print(f"Job summary: {response_item.job_summary}")
        print(f"Job title snippet: {response_item.job_title_snippet}")
        job = response_item.job
        results.append(job.name)
        print(f"Job name: {job.name}")
        print(f"Job title: {job.title}")
    return results