Atributos personalizados (v3)

O Cloud Talent Solution dispõe de diversos atributos de vaga predefinidos para atender às necessidades de vários clientes. Use os campos predefinidos para o melhor desempenho do Cloud Talent Solution.

Além disso, o Cloud Talent Solution também inclui atributos personalizados para armazenar informações genéricas. Os atributos personalizados são usados para fornecer ainda mais flexibilidade a fim de permitir compatibilidade com a lógica de negócio dos clientes. Os atributos personalizados armazenam informações de string ou numéricas e podem ser filtrados nas consultas de pesquisa por meio da definição de filtros apropriados.

Recursos dos atributos personalizados

  • Definir o próprio nome do campo personalizado: defina um nome para um determinado atributo de uma vaga. Defina esse atributo para ser filtrável ou não filtrável, dependendo da necessidade. Normalmente, caso a IU precise de um atributo filtrável que não seja predefinido no Cloud Talent Solution, um customAttribute poderá ser usado para fornecer a filtragem certa.
  • Pesquisa (in)diferente a maiúsculas: cada solicitação de pesquisa pode especificar se a pesquisa em todos os atributos personalizados é indiferente a maiúsculas.
  • Filtragem baseada em intervalo: os filtros de pesquisa por customAttribute podem filtrar vagas em um intervalo de valores numéricos especificados. Por exemplo, se um campo customAttribute for usado para armazenar os requisitos mínimos de GPA de uma vaga, o filtro de pesquisa customAttribute poderá ser usado para retornar vagas dentro de um determinado intervalo mínimo de GPA, acima de um valor mínimo de GPA, abaixo de um valor mínimo de GPA etc.
  • Filtragem entre campos: customAttribute também capacitam os clientes do Cloud Talent Solution a definir expressões que filtram uma combinação de atributos personalizados. Por exemplo, um cliente tem uma lógica de negócios que afirma que ele quer apenas vagas que concedam vistos ou de trabalho remoto. O cliente armazena esses dois campos em um customAttribute diferente. O cliente pode especificar um filtro de pesquisa com uma expressão que defina a lógica necessária. Somente três níveis de expressões aninhadas são permitidos.

  • Pesquisa específica por palavra-chave: especifique um determinado customAttribute no keywordSearchableCustomAttributes da empresa associada para garantir que solicitações de pesquisa contendo um valor no customAttribute especificado retornem as vagas com esse valor no customAttribute.

  • Pesquisas baseadas em SQL: customAttribute permite definir expressões de estilo booleano na solicitação de pesquisa. O Cloud Talent Solution analisa automaticamente essas expressões, aplica os filtros à solicitação de pesquisa e retorna os resultados pertinentes. Somente três níveis de aninhamento das expressões booleanas e, no máximo, 2.000 caracteres são permitidos.

  • Definir buckets de histograma personalizados: os atributos personalizados permitem que os clientes do Cloud Talent Solution definam buckets personalizados para cálculo dos histogramas. Por exemplo, é possível usar um customAttribute para armazenar informações mínimas sobre o GPA e criar um histograma nesse campo. Você também pode criar buckets de 3.0 a 3.5, de 3.51 a 4.0 etc. para agrupar todos os GPAs mínimos nesses buckets.

Como usar atributos personalizados

Crie uma nova vaga com o campo customAttribute (numérico ou string):

Java

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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
}

Crie um filtro no campo customAttribute:

Java

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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
}

Crie outro filtro com customAttribute:

Java

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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
}

Aproveite atributos personalizados para facilitar a filtragem entre campos:

No exemplo a seguir, veja como definir uma solicitação de pesquisa que procura vagas com uma meta de taxa de bônus entre 10% e 20% ou uma vaga que exija habilidades de "Gerenciamento de equipe" OU uma vaga que tenha um valor não vazio no customAttribute "visa_required".

Java

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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

Para mais informações sobre a instalação e criação de um cliente do Cloud Talent Solution, consulte Bibliotecas de cliente do 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
}

Por padrão, os endpoints searchJobs e seachJobsForAlert pesquisam apenas nos campos predefinidos. Caso você também precise pesquisar em campos customAttribute, use o campo keywordSearchableJobCustomAttributes para definir uma lista de atributos personalizados para pesquisa.

Por exemplo, caso um recrutador queira usar um customAttribute "customRequisitions" para armazenar os códigos de requisição de vagas pertinentes a um determinado empregador, ele deve definir keywordSearchableJobCustomAttributes para incluir esse campo. Dessa forma, ao pesquisar "ABC123" normalmente, serão retornadas todas as vagas que tenham o customAttribute "customRequisitions" com o valor "ABC123".