Attributi personalizzati (v3)

Cloud Talent Solution fornisce diversi attributi di lavoro predefiniti per soddisfare le esigenze di vari clienti. Per ottenere il massimo rendimento da Cloud Talent Solution, ti consigliamo vivamente di utilizzare i campi predefiniti il più possibile.

Inoltre, Cloud Talent Solution fornisce anche attributi personalizzati per archiviare informazioni generiche. Gli attributi personalizzati vengono utilizzati per offrire ancora più flessibilità e consentire ai clienti di supportare la propria logica di business. Gli attributi personalizzati memorizzano informazioni numeriche o stringhe e possono essere filtrati nelle query di ricerca impostando filtri appropriati.

Funzionalità degli attributi personalizzati

  • Definisci il nome del campo personalizzato: definisci un nome per un particolare attributo di un lavoro. Imposta questo attributo in modo che sia filtrabile o non filtrabile a seconda delle necessità. In genere, se la UI ha bisogno di una sfaccettatura filtrabile che non è fornita immediatamente da Cloud Talent Solution, è possibile utilizzare un customAttribute per fornire il filtro corretto.
  • Ricerca sensibile alle maiuscole e minuscole: ogni richiesta di ricerca può specificare se la ricerca in tutti gli attributi personalizzati è sensibile alle maiuscole e minuscole o meno.
  • Filtro basato sull'intervallo: i filtri di ricerca customAttribute possono filtrare i lavori in un intervallo di valori numerici specificati. Ad esempio, se un determinato campo customAttribute viene utilizzato per memorizzare i requisiti di GPA minimi di un lavoro, il filtro di ricerca customAttribute può essere utilizzato per restituire i lavori all'interno di un determinato intervallo di GPA minimo, superiore a un valore di GPA minimo, inferiore a un valore di GPA minimo e così via.
  • Filtro tra campi: customAttribute offre anche ai clienti di Cloud Talent Solution la possibilità di definire espressioni che filtrano una combinazione di attributi personalizzati. Ad esempio, un cliente ha una logica di business che prevede solo lavori che sponsorizzano visti o lavori in telecommuting. Il cliente memorizza entrambi questi campi in un customAttribute diverso. Il cliente può quindi specificare un filtro di ricerca con un'espressione che definisce la logica necessaria. Sono supportati solo 3 livelli di espressioni nidificate.

  • Ricerca specifica per parola chiave: specifica un determinato customAttribute nel keywordSearchableCustomAttributes dell'azienda associata per assicurarti che le richieste di ricerca che contengono un valore nell'attributo personalizzato specificato restituiscano le offerte di lavoro che contengono questo valore nell'attributo personalizzato.

  • Ricerche basate su SQL:customAttribute ti consente di definire espressioni in stile booleano nella richiesta di ricerca. Cloud Talent Solution analizza automaticamente queste espressioni, applica i filtri alla richiesta di ricerca e restituisce i risultati di conseguenza. Sono consentiti solo 3 livelli di nidificazione delle espressioni booleane e al massimo 2000 caratteri.

  • Definisci bucket dell'istogramma personalizzati:gli attributi personalizzati consentono ai clienti di Cloud Talent Solution di impostare bucket personalizzati in base ai quali è possibile calcolare gli istogrammi. Ad esempio, puoi utilizzare un customAttribute per memorizzare le informazioni sul GPA minimo e poi creare un istogramma su questo campo. Puoi creare ulteriori bucket da 3,0 - 3,5, 3,51 - 4,0 e così via, per raggruppare tutti i GPA minimi all'interno di questi bucket.

Utilizzo degli attributi personalizzati

Crea un nuovo job con il campo customAttribute (può essere utilizzato con valori numerici o stringa):

Java

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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
}

Crea un filtro nel campo customAttribute:

Java

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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
}

Crea un altro filtro con customAttribute:

Java

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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
}

Utilizzare gli attributi personalizzati per facilitare il filtro incrociato:

L'esempio seguente illustra come definire una richiesta di ricerca che cerca lavori con un tasso di bonus target compreso tra il 10% e il 20%, oppure un lavoro che richiedeva le competenze di "Gestione del team" OPPURE un lavoro che ha un valore non vuoto nel campo "visa_required" (visto richiesto) customAttribute.

Java

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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

Per saperne di più sull'installazione e la creazione di un client Cloud Talent Solution, consulta Librerie client 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
}

Per impostazione predefinita, gli endpoint searchJobs e seachJobsForAlert eseguono la ricerca solo nei campi predefiniti. Se devi eseguire ricerche anche nei campi customAttribute, utilizza il campo keywordSearchableJobCustomAttributes per definire un elenco di attributi personalizzati in cui eseguire la ricerca.

Ad esempio, se un reclutatore vuole utilizzare un customAttribute "customRequisitions" per memorizzare gli ID richiesta di lavoro particolari per un datore di lavoro specifico, impostando keywordSearchableJobCustomAttributes in modo da includere questo campo, una normale ricerca condotta da un reclutatore per "ABC123" restituisce tutti i lavori che hanno il customAttribute "customRequisitions" con un valore di "ABC123".