Autocomplete (v3)

Cloud Talent Solution memberikan saran pelengkapan otomatis untuk judul lowongan dan nama perusahaan. Hanya postingan lowongan aktif dan perusahaan dengan minimal satu lowongan terbuka yang dianggap memenuhi syarat untuk hasil saran. Setelah pekerjaan atau perusahaan baru ditambahkan, perlu waktu hingga 48 jam agar informasi ditambahkan ke kumpulan hasil pelengkapan otomatis.

Untuk menggunakan pelengkapan otomatis, panggil metode complete saat kotak penelusuran diperbarui.

Java

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


/** Auto completes job titles within given companyName. */
public static void jobTitleAutoComplete(String companyName, String query) throws IOException {

  Complete complete =
      talentSolutionClient
          .projects()
          .complete(DEFAULT_PROJECT_ID)
          .setQuery(query)
          .setLanguageCode("en-US")
          .setType("JOB_TITLE")
          .setPageSize(10);
  if (companyName != null) {
    complete.setCompanyName(companyName);
  }

  CompleteQueryResponse results = complete.execute();

  System.out.println(results);
}

Python

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

def job_title_auto_complete(client_service, query, company_name):
    complete = client_service.projects().complete(
        name=name, query=query, languageCode="en-US", type="JOB_TITLE", pageSize=10
    )
    if company_name is not None:
        complete.companyName = company_name

    results = complete.execute()
    print(results)

Node.js

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


const talent = require('@google-cloud/talent').v4;

/**
 * Complete job title given partial text (autocomplete)
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the TenantId
 */
function sampleCompleteQuery(
  projectId,
  tenantId,
  query,
  numResults,
  languageCode
) {
  const client = new talent.CompletionClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const query = '[partially typed job title]';
  // const numResults = 5;
  // const languageCode = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const languageCodes = [languageCode];
  const request = {
    parent: formattedParent,
    query: query,
    pageSize: numResults,
    languageCodes: languageCodes,
  };
  client
    .completeQuery(request)
    .then(responses => {
      const response = responses[0];
      for (const result of response.completionResults) {
        console.log(`Suggested title: ${result.suggestion}`);
        // Suggestion type is JOB_TITLE or COMPANY_TITLE
        console.log(`Suggestion type: ${result.type}`);
      }
    })
    .catch(err => {
      console.error(err);
    });
}