Attributi personalizzati (v3)

Cloud Talent Solution offre preconfigurati diversi attributi professionali per supportare le esigenze di vari clienti. Per ottenere le migliori prestazioni da Cloud Talent Solution, ti consigliamo vivamente di utilizzare il più possibile i campi predefiniti.

Inoltre, Cloud Talent Solution fornisce anche attributi personalizzati per archiviare informazioni generiche. Gli attributi personalizzati offrono una flessibilità ancora maggiore e consentono ai clienti di supportare la logica di business. Gli attributi personalizzati memorizzano una stringa o informazioni numeriche e possono essere filtrati in base alle query di ricerca impostando filtri adeguati.

Funzionalità degli attributi personalizzati

  • Definisci il nome del campo personalizzato: definisci un nome per un determinato attributo di un job. Imposta questo attributo in modo che sia filtrabile o non filtrabile a seconda delle esigenze. In genere, se l'UI richiede un facet filtrabile che non è fornito pronto all'uso da Cloud Talent Solution, è possibile utilizzare customAttribute per fornire il filtro giusto.
  • Ricerca con distinzione tra maiuscole e minuscole (senza): ogni richiesta di ricerca può specificare se la ricerca per tutti gli attributi personalizzati è sensibile alle maiuscole o non fa distinzione tra maiuscole e minuscole.
  • Filtro basato su intervallo: customAttribute filtri di ricerca possono filtrare i job tra un intervallo di valori numerici specificati. Ad esempio, se un determinato campo customAttribute viene utilizzato per archiviare i requisiti minimi di GPA di un job, è possibile usare il filtro di ricerca customAttribute per restituire i job entro un determinato intervallo GPA minimo, superiore a un valore GPA minimo, inferiore a un valore GPA minimo e così via.
  • Filtraggio su più campi: customAttribute offre inoltre 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 afferma che vuole solo lavori che sponsorizzano visti o lavori di telelavoro. Il cliente archivia entrambi questi campi in un customAttribute diverso. Il cliente può quindi specificare un filtro di ricerca con un'espressione che definisca la logica necessaria. Sono supportati solo 3 livelli di espressioni nidificate.

  • Ricerca specifica per parola chiave: specifica un determinato customAttribute nella keywordSearchableCustomAttributes dell'azienda associata per garantire che le richieste di ricerca contenenti un valore nell'attributo customAttribute specificato restituiscano i job contenenti questo valore in quel customAttribute.

  • Ricerche basate su SQL: customAttribute consente di definire espressioni di 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 un massimo di 2000 caratteri.

  • Definisci bucket a istogrammi personalizzati: gli attributi personalizzati consentono ai clienti di Cloud Talent Solution di impostare bucket personalizzati in base ai quali possono essere calcolati gli istogrammi. Ad esempio, puoi utilizzare un valore customAttribute per memorizzare informazioni minime su GPA e creare un istogramma in questo campo. Puoi creare ulteriormente bucket da 3,0 a 3,5, 3,51 - 4,0 e così via, per raggruppare tutti i GPA minimi all'interno di questi bucket.

Utilizzo di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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
}

Utilizza gli attributi personalizzati per facilitare l'applicazione di filtri incrociati:

L'esempio seguente illustra come definire una richiesta di ricerca che cerca offerte di lavoro con una tariffa bonus target compresa tra il 10% e il 20% o un lavoro che richiedeva le competenze di "gestione del team" OPPURE un lavoro che ha un valore non vuoto nel campo customAttribute di "visa_required".

Java

Per saperne di più sull'installazione e sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 sulla creazione di un client di Cloud Talent Solution, consulta Librerie client di 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 cercare anche nei campi customAttributes, utilizza il campo keywordSearchableJobCustomAttributes per definire un elenco di attributi personalizzati da cercare.

Ad esempio, se un reclutatore vuole utilizzare un customAttribute "Requisiti personalizzati" per archiviare gli ID richieste dei lavori specifici di un datore di lavoro specifico, impostando keywordSearchableJobCustomAttributes in modo da includere questo campo, una normale ricerca effettuata da un selezionatore per "ABC123" restituisce tutti i job che hanno i "Requisiti personalizzati" customAttribute con un valore di "ABC123".