カスタム属性(v3)

Cloud Talent Solution には、さまざまなお客様のニーズに対応するために、すぐに使用できる求人属性が複数用意されています。Cloud Talent Solution が最大のパフォーマンスを発揮できるよう、このすぐに使用可能な項目をできる限り活用することを強くおすすめします。

さらに、Cloud Talent Solution には全般的な情報を保存するカスタム属性も用意されています。カスタム属性を使用すると、お客様のビジネス ロジックに対応するための柔軟性がさらに高まります。カスタム属性には文字列または数値のいずれかの情報が保存され、適切なフィルタを設定することで、カスタム属性を検索クエリのフィルタ対象に設定できます。

カスタム属性機能

  • 独自のカスタム項目名の定義: 求人の特定の属性名を定義します。この属性は、要件に応じてフィルタ可能かフィルタ不可能に設定します。UI でフィルタ可能ファセットが必要な場合、それがすぐに使用できる形で Cloud Talent Solution により用意されていなければ、通常は customAttribute を使用して適切なフィルタリングを行うことができます。
  • 大文字と小文字を区別する(しない)検索: 各検索リクエストで、すべてのカスタム属性に対する検索が大文字と小文字を区別するかどうかを指定できます。
  • 範囲ベースのフィルタリング: customAttribute 検索フィルタでは、指定した数値の範囲の間で求人情報を絞り込むことができます。たとえば、特定の customAttribute 項目を使用して求人情報の最低 GPA 要件を保存する場合は、customAttribute 検索フィルタを使用して、最低 GPA が特定の範囲にある求人情報、最低 GPA 値より高い求人情報、最低 GPA 値より低い求人情報などが返されるように設定できます。
  • 項目間フィルタリング: customAttribute を使用すると、Cloud Talent Solution のお客様は、複数のカスタム属性の組み合わせをフィルタリングする式を定義できます。たとえば、お客様のビジネス ロジックに、ビザを提供する求人と在宅勤務の求人のみを希望することが記載されている場合があります。この場合はこの両方の項目を異なる customAttribute に保存します。これで、必要なロジックを定義する式を使用して検索フィルタを指定できます。ネストレベルが 3 つの式のみがサポートされています。

  • キーワード固有の検索: 関連する会社の keywordSearchableCustomAttributes に特定の customAttribute を指定することで、指定された customAttribute に値を含む検索リクエストによって、その customAttribute にこの値を含む求人情報が返されるようにします。

  • SQL ベースの検索: customAttribute を使用すると、検索リクエストでブール形式の式を定義できます。Cloud Talent Solution はこうした式を自動的に解析し、その検索リクエストにフィルタを適用して得られた結果を返します。ネストレベルが 3 つのブール式のみが許容され、使用できる最大文字数は 2,000 文字です。

  • カスタム ヒストグラム バケットの定義: カスタム属性を使用すると、Cloud Talent Solution のお客様がヒストグラムの計算に使用できるカスタム バケットを設定できます。 たとえば、customAttribute を使用して最低 GPA 情報を保存し、この項目にヒストグラムを作成できます。さらに 3.0 から 3.5、3.51 から 4.0 などのバケットを作成し、それらのバケット内ですべての最低 GPA をグループ化できます。

カスタム属性の使用

customAttribute 項目を使用して新しい求人情報を作成します(この項目には数値と文字列のどちらも使用できます)。

Java

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


/** Generate a job with a custom attribute. */
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
public static Job generateJobWithACustomAttribute(String companyName) {
  // requisition id should be a unique Id in your system.
  String requisitionId = "jobWithACustomAttribute:" + String.valueOf(new Random().nextLong());
  ApplicationInfo applicationInfo =
      new ApplicationInfo().setUris(Arrays.asList("http://careers.google.com"));

  // Constructs custom attributes map
  Map<String, CustomAttribute> customAttributes = new HashMap<>();
  customAttributes.put(
      "someFieldName1",
      new CustomAttribute().setStringValues(Arrays.asList("value1")).setFilterable(Boolean.TRUE));
  customAttributes.put(
      "someFieldName2",
      new CustomAttribute().setLongValues(Arrays.asList(256L)).setFilterable(true));

  // Creates job with custom attributes
  Job job =
      new Job()
          .setCompanyName(companyName)
          .setRequisitionId(requisitionId)
          .setTitle("Software Engineer")
          .setApplicationInfo(applicationInfo)
          .setDescription("Design, develop, test, deploy, maintain and improve software.")
          .setCustomAttributes(customAttributes);
  System.out.println("Job generated: " + job);
  return job;
}

Python

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。

def generate_job_with_custom_attributes(company_name):
    # Requisition id should be a unique Id in your system.
    requisition_id = "job_with_custom_attributes:" + "".join(
        random.choice(string.ascii_uppercase + string.digits) for _ in range(16)
    )

    job_title = "Software Engineer"
    application_urls = ["http://careers.google.com"]
    description = "Design, develop, test, deploy, maintain and improve " "software."

    custom_attributes = {
        "someFieldName1": {"string_values": ["value1"], "filterable": True},
        "someFieldName2": {"long_values": [256], "filterable": True},
    }

    job = {
        "company_name": company_name,
        "requisition_id": requisition_id,
        "title": job_title,
        "application_info": {"uris": application_urls},
        "description": description,
        "custom_attributes": custom_attributes,
    }
    print("Job generated: %s" % job)
    return job

Go

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


// constructJobWithCustomAttributes constructs a job with custom attributes.
func constructJobWithCustomAttributes(companyName string, jobTitle string) *talent.Job {
	// requisitionID shoud be the unique ID in your system
	requisitionID := fmt.Sprintf("job-with-custom-attribute-%d", time.Now().UnixNano())

	job := &talent.Job{
		RequisitionId: requisitionID,
		Title:         jobTitle,
		CompanyName:   companyName,
		ApplicationInfo: &talent.ApplicationInfo{
			Uris: []string{"https://googlesample.com/career"},
		},
		Description: "Design, devolop, test, deploy, maintain and improve software.",
		CustomAttributes: map[string]talent.CustomAttribute{
			"someFieldString": {
				Filterable:   true,
				StringValues: []string{"someStrVal"},
			},
			"someFieldLong": {
				Filterable: true,
				LongValues: []int64{900},
			},
		},
	}
	return job
}

customAttribute 項目にフィルタを作成します。

Java

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


/** CustomAttributeFilter on String value CustomAttribute */
public static void filtersOnStringValueCustomAttribute()
    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");

  String customAttributeFilter = "NOT EMPTY(someFieldName1)";
  JobQuery jobQuery = new JobQuery().setCustomAttributeFilter(customAttributeFilter);

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

Python

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。

def custom_attribute_filter_string_value(client_service):
    request_metadata = {
        "user_id": "HashedUserId",
        "session_id": "HashedSessionId",
        "domain": "www.google.com",
    }

    custom_attribute_filter = "NOT EMPTY(someFieldName1)"
    job_query = {"custom_attribute_filter": custom_attribute_filter}
    request = {
        "request_metadata": request_metadata,
        "job_query": job_query,
        "job_view": "JOB_VIEW_FULL",
    }

    response = (
        client_service.projects().jobs().search(parent=parent, body=request).execute()
    )
    print(response)

Go

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


// filterOnStringValueCustomAttribute searches for jobs on a string value custom
// atrribute.
func filterOnStringValueCustomAttribute(w io.Writer, projectID 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)
	}

	parent := "projects/" + projectID
	req := &talent.SearchJobsRequest{
		JobQuery: &talent.JobQuery{
			CustomAttributeFilter: "NOT EMPTY(someFieldString)",
		},
		// 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",
		},
		JobView: "JOB_VIEW_FULL",
	}
	resp, err := service.Projects.Jobs.Search(parent, req).Do()
	if err != nil {
		return nil, fmt.Errorf("failed to search for jobs with string value custom attribute: %w", err)
	}

	fmt.Fprintln(w, "Jobs:")
	for _, j := range resp.MatchingJobs {
		fmt.Fprintf(w, "\t%q\n", j.Job.Name)
	}

	return resp, nil
}

customAttribute を使用して別のフィルタを作成します。

Java

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


/** CustomAttributeFilter on Long value CustomAttribute */
public static void filtersOnLongValueCustomAttribute() 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");

  String customAttributeFilter = "(255 <= someFieldName2) AND (someFieldName2 <= 257)";
  JobQuery jobQuery = new JobQuery().setCustomAttributeFilter(customAttributeFilter);

  SearchJobsRequest searchJobsRequest =
      new SearchJobsRequest()
          .setJobQuery(jobQuery)
          .setJobView("JOB_VIEW_FULL")
          .setRequestMetadata(requestMetadata);

  SearchJobsResponse response =
      talentSolutionClient
          .projects()
          .jobs()
          .search(DEFAULT_PROJECT_ID, searchJobsRequest)
          .execute();
  Thread.sleep(1000);
  System.out.printf("Custom search job results (Long value): %s\n", response);
}

Python

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。

def custom_attribute_filter_long_value(client_service):
    request_metadata = {
        "user_id": "HashedUserId",
        "session_id": "HashedSessionId",
        "domain": "www.google.com",
    }

    custom_attribute_filter = "(255 <= someFieldName2) AND" " (someFieldName2 <= 257)"
    job_query = {"custom_attribute_filter": custom_attribute_filter}
    request = {
        "request_metadata": request_metadata,
        "job_query": job_query,
        "job_view": "JOB_VIEW_FULL",
    }

    response = (
        client_service.projects().jobs().search(parent=parent, body=request).execute()
    )
    print(response)

Go

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


// filterOnLongValueCustomAttribute searches for jobs on a long value custom
// atrribute.
func filterOnLongValueCustomAttribute(w io.Writer, projectID 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)
	}

	parent := "projects/" + projectID
	req := &talent.SearchJobsRequest{
		JobQuery: &talent.JobQuery{
			CustomAttributeFilter: "someFieldLong < 1000",
		},
		// 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",
		},
		JobView: "JOB_VIEW_FULL",
	}
	resp, err := service.Projects.Jobs.Search(parent, req).Do()
	if err != nil {
		return nil, fmt.Errorf("failed to search for jobs with long value custom attribute: %w", err)
	}

	fmt.Fprintln(w, "Jobs:")
	for _, j := range resp.MatchingJobs {
		fmt.Fprintf(w, "\t%q\n", j.Job.Name)
	}

	return resp, nil
}

カスタム属性を活用して項目間フィルタリングを可能にします。

次の例は、目標の賞与率が 10%~20% である求人、「チーム マネジメント」のスキルが必須である求人、「visa_required」の customAttribute の値が空でない求人のいずれかを検索する検索リクエストの定義方法を示しています。

Java

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


/** CustomAttributeFilter on multiple CustomAttributes */
public static void filtersOnMultiCustomAttributes() 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");

  String customAttributeFilter =
      "(someFieldName1 = \"value1\") "
          + "AND ((255 <= someFieldName2) OR (someFieldName2 <= 213))";
  JobQuery jobQuery = new JobQuery().setCustomAttributeFilter(customAttributeFilter);

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

Python

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。

def custom_attribute_filter_multi_attributes(client_service):
    request_metadata = {
        "user_id": "HashedUserId",
        "session_id": "HashedSessionId",
        "domain": "www.google.com",
    }

    custom_attribute_filter = (
        '(someFieldName1 = "value1") AND ((255 <= someFieldName2) OR '
        "(someFieldName2 <= 213))"
    )
    job_query = {"custom_attribute_filter": custom_attribute_filter}
    request = {
        "request_metadata": request_metadata,
        "job_query": job_query,
        "job_view": "JOB_VIEW_FULL",
    }

    response = (
        client_service.projects().jobs().search(parent=parent, body=request).execute()
    )
    print(response)

Go

Cloud Talent Solution クライアントのインストールと作成の詳細については、Cloud Talent Solution クライアント ライブラリをご覧ください。


// filterOnLongValueCustomAttribute searches for jobs on multiple custom
// atrributes.
func filterOnMultiCustomAttributes(w io.Writer, projectID 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)
	}

	parent := "projects/" + projectID
	req := &talent.SearchJobsRequest{
		JobQuery: &talent.JobQuery{
			CustomAttributeFilter: "(someFieldString = \"someStrVal\") AND (someFieldLong < 1000)",
		},
		// 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",
		},
		JobView: "JOB_VIEW_FULL",
	}
	resp, err := service.Projects.Jobs.Search(parent, req).Do()
	if err != nil {
		return nil, fmt.Errorf("failed to search for jobs with multiple custom attributes: %w", err)
	}

	fmt.Fprintln(w, "Jobs:")
	for _, j := range resp.MatchingJobs {
		fmt.Fprintf(w, "\t%q\n", j.Job.Name)
	}

	return resp, nil
}

デフォルトでは、searchJobs エンドポイントと seachJobsForAlert エンドポイントの検索対象はすぐに使用できるように用意された項目のみです。customAttribute 項目に対する検索も行う必要がある場合は、keywordSearchableJobCustomAttributes 項目を使用して、検索するカスタム属性のリストを定義します。

たとえば、採用担当者が customAttribute「customRequisitions」を使用して特定の雇用主に特化した求人の求人 ID を保存することを希望する場合、この項目を含むように keywordSearchableJobCustomAttributes を設定することで、この採用担当者が「ABC123」を対象に実施する通常の検索において、customAttribute「customRequisitions」に値「ABC123」が設定されたすべての求人情報が返されます。