Atribut khusus (v4beta1)

Cloud Talent Solution menyediakan beberapa atribut tugas yang siap pakai untuk mendukung kebutuhan berbagai pelanggan. Untuk mendapatkan performa terbaik dari Cloud Talent Solution, Anda sangat disarankan untuk menggunakan kolom siap pakai sebanyak mungkin.

Selain itu, Cloud Talent Solution juga menyediakan atribut khusus untuk menyimpan informasi umum. Atribut khusus digunakan untuk memberikan fleksibilitas yang lebih besar agar pelanggan dapat mendukung logika bisnis mereka. Atribut khusus menyimpan informasi numerik atau string, dan dapat difilter dalam kueri penelusuran dengan menyetel filter yang sesuai.

Fitur atribut khusus

  • Tentukan nama kolom kustom Anda sendiri: Tentukan nama untuk atribut tertentu dari suatu tugas. Tetapkan atribut ini menjadi dapat difilter atau tidak dapat difilter bergantung pada kebutuhan Anda. Biasanya, jika UI memerlukan faset yang dapat difilter yang tidak disediakan langsung oleh Cloud Talent Solution, customAttribute dapat digunakan untuk memberikan pemfilteran yang tepat.
  • Penelusuran peka huruf besar/kecil (dalam): Setiap permintaan penelusuran dapat menentukan apakah penelusuran terhadap semua atribut khusus peka huruf besar/kecil atau tidak peka huruf besar/kecil.
  • Pemfilteran berbasis rentang: Filter penelusuran customAttribute dapat memfilter tugas di antara rentang nilai numerik yang ditentukan. Misalnya, jika kolom customAttribute tertentu digunakan untuk menyimpan persyaratan IPK minimum suatu pekerjaan, filter penelusuran customAttribute dapat digunakan untuk menampilkan lowongan dalam rentang IPK minimum tertentu, lebih besar dari nilai IPK minimum, lebih kecil dari nilai IPK minimum, dll.
  • Pemfilteran lintas kolom: customAttribute juga memberi pelanggan Cloud Talent Solution untuk menentukan ekspresi yang memfilter kombinasi atribut khusus. Misalnya, pelanggan memiliki logika bisnis yang menyatakan bahwa ia hanya menginginkan pekerjaan yang mensponsori visa, atau pekerjaan dari jarak jauh. Pelanggan menyimpan kedua kolom ini dalam customAttribute yang berbeda. Pelanggan kemudian dapat menentukan filter penelusuran dengan ekspresi yang mendefinisikan logika yang diperlukan. Hanya 3 level ekspresi bertingkat yang didukung.

  • Penelusuran khusus kata kunci: Tentukan customAttribute tertentu dalam keywordSearchableCustomAttributes perusahaan terkait untuk memastikan permintaan penelusuran yang berisi nilai dalam customAttribute yang ditentukan menampilkan tugas yang berisi nilai ini dalam customAttribute tersebut.

  • Penelusuran berbasis SQL: customAttribute memungkinkan Anda menentukan ekspresi gaya boolean dalam permintaan penelusuran. Cloud Talent Solution akan otomatis mengurai ekspresi ini, menerapkan filter ke permintaan penelusuran, dan menampilkan hasilnya. Hanya 3 tingkat penyusunan bertingkat ekspresi boolean dan maksimal 2.000 karakter yang diperbolehkan.

  • Menentukan bucket histogram kustom: Atribut khusus memungkinkan pelanggan Cloud Talent Solution untuk menetapkan bucket kustom yang dapat digunakan untuk menghitung histogram. Misalnya, Anda dapat menggunakan customAttribute untuk menyimpan informasi IPK minimum, lalu membuat histogram di kolom ini. Selanjutnya, Anda dapat membuat bucket dari 3.0 - 3.5, 3.51 - 4.0, dst., untuk mengelompokkan semua IPK minimum dalam bucket tersebut.

Menggunakan atribut khusus

Buat tugas baru dengan kolom customAttribute (dapat digunakan dengan nilai numerik atau string):

Go

Untuk mempelajari cara menginstal dan menggunakan library klien untuk CTS, lihat library klien CTS. Untuk informasi selengkapnya, lihat dokumentasi referensi API CTS Go.

Untuk mengautentikasi ke CTS, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, baca Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"cloud.google.com/go/talent/apiv4beta1/talentpb"
	"github.com/gofrs/uuid"
	money "google.golang.org/genproto/googleapis/type/money"
)

// createJobWithCustomAttributes creates a job with custom attributes.
func createJobWithCustomAttributes(w io.Writer, projectID, companyID, jobTitle string) (*talentpb.Job, error) {
	ctx := context.Background()

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

	// requisitionID shoud be the unique ID in your system
	requisitionID := fmt.Sprintf("job-with-custom-attribute-%s", uuid.Must(uuid.NewV4()).String())
	jobToCreate := &talentpb.Job{
		Company:       fmt.Sprintf("projects/%s/companies/%s", projectID, companyID),
		RequisitionId: requisitionID,
		Title:         jobTitle,
		ApplicationInfo: &talentpb.Job_ApplicationInfo{
			Uris: []string{"https://googlesample.com/career"},
		},
		Description:     "Design, devolop, test, deploy, maintain and improve software.",
		LanguageCode:    "en-US",
		PromotionValue:  2,
		EmploymentTypes: []talentpb.EmploymentType{talentpb.EmploymentType_FULL_TIME},
		Addresses:       []string{"Mountain View, CA"},
		CustomAttributes: map[string]*talentpb.CustomAttribute{
			"someFieldString": {
				Filterable:   true,
				StringValues: []string{"someStrVal"},
			},
			"someFieldLong": {
				Filterable: true,
				LongValues: []int64{900},
			},
		},
		CompensationInfo: &talentpb.CompensationInfo{
			Entries: []*talentpb.CompensationInfo_CompensationEntry{
				{
					Type: talentpb.CompensationInfo_BASE,
					Unit: talentpb.CompensationInfo_HOURLY,
					CompensationAmount: &talentpb.CompensationInfo_CompensationEntry_Amount{
						Amount: &money.Money{
							CurrencyCode: "USD",
							Units:        1,
						},
					},
				},
			},
		},
	}

	// Construct a createJob request.
	req := &talentpb.CreateJobRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		Job:    jobToCreate,
	}

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

	fmt.Fprintf(w, "Created job with custom attributres: %q\n", resp.GetName())
	fmt.Fprintf(w, "Custom long field has value: %v\n", resp.GetCustomAttributes()["someFieldLong"].GetLongValues())

	return resp, nil
}

Java

Untuk mengetahui informasi selengkapnya tentang cara menginstal dan membuat klien Cloud Talent Solution, lihat Library Klien Cloud Talent Solution.


import com.google.cloud.talent.v4beta1.CreateJobRequest;
import com.google.cloud.talent.v4beta1.CustomAttribute;
import com.google.cloud.talent.v4beta1.Job;
import com.google.cloud.talent.v4beta1.JobServiceClient;
import com.google.cloud.talent.v4beta1.TenantName;
import java.io.IOException;

public class JobSearchCreateJobCustomAttributes {

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

  // Create Job with Custom Attributes.
  public static void createJob(
          String projectId,
          String tenantId,
          String companyId,
          String requisitionId)
          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);

      // Custom attribute can be string or numeric value, and can be filtered in search queries.
      // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
      CustomAttribute customAttribute = CustomAttribute.newBuilder()
              .addStringValues("Internship")
              .addStringValues("Apprenticeship")
              .setFilterable(true)
              .build();

      Job job =
              Job.newBuilder()
                      .setCompany(companyId)
                      .setTitle("Software Developer I")
                      .setDescription("This is a description of this <i>wonderful</i> job!")
                      .putCustomAttributes("FOR_STUDENTS", customAttribute)
                      .setRequisitionId(requisitionId)
                      .setLanguageCode("en-US")
                      .build();

      CreateJobRequest request =
              CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
      Job response = jobServiceClient.createJob(request);
      System.out.printf("Created job: %s\n", response.getName());
    }
  }
}

Python

Untuk mengetahui informasi selengkapnya tentang cara menginstal dan membuat klien Cloud Talent Solution, lihat Library Klien Cloud Talent Solution.


from google.cloud import talent

def create_job(project_id, tenant_id, company_id, requisition_id):
    """Create Job with Custom Attributes"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id = 'Job requisition ID, aka Posting ID. Unique per job.'
    # language_code = 'en-US'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(company_id, bytes):
        company_id = company_id.decode("utf-8")

    # Custom attribute can be string or numeric value,
    # and can be filtered in search queries.
    # https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
    custom_attribute = talent.CustomAttribute()
    custom_attribute.filterable = True
    custom_attribute.string_values.append("Intern")
    custom_attribute.string_values.append("Apprenticeship")

    parent = f"projects/{project_id}/tenants/{tenant_id}"

    job = talent.Job(
        company=company_id,
        title="Software Engineer",
        requisition_id=requisition_id,
        description="This is a description of this job",
        language_code="en-us",
        custom_attributes={"FOR_STUDENTS": custom_attribute},
    )

    response = client.create_job(parent=parent, job=job)
    print(f"Created job: {response.name}")
    return response.name

Secara default, endpoint searchJobs dan searchJobsForAlert hanya menelusuri kolom otomatis. Jika Anda juga perlu melakukan penelusuran dengan kolom customAttribute, gunakan kolom keywordSearchableJobCustomAttributes untuk menentukan daftar atribut khusus yang akan ditelusuri.

Misalnya, jika seorang perekrut ingin menggunakan customAttribute "customRequisitions" untuk menyimpan ID permintaan pekerjaan khusus untuk perusahaan tertentu, maka dengan menetapkan keywordSearchableJobCustomAttributes untuk menyertakan kolom ini, penelusuran reguler yang dilakukan oleh perekrut untuk "ABC123" akan menampilkan semua pekerjaan yang memiliki customAttribute "customRequisitions" dengan nilai "ABC123".