Stay organized with collections
Save and categorize content based on your preferences.
Cloud Talent Solution provides autocomplete suggestions for job titles and
company names. Only active job postings and companies with at least one open
job are considered eligible for suggestion results. Once a new job or company
is added, it takes up to 48 hours for the information to be added to the
autocomplete result set.
To use autocomplete, call the complete method when the search bar is updated.
import("context""fmt""io"talent"cloud.google.com/go/talent/apiv4beta1""cloud.google.com/go/talent/apiv4beta1/talentpb")// jobTitleAutoComplete suggests the job titles of the given// company identifier on query.funcjobTitleAutocomplete(wio.Writer,projectID,querystring)(*talentpb.CompleteQueryResponse,error){ctx:=context.Background()// Initialize a completionService client.c,err:=talent.NewCompletionClient(ctx)iferr!=nil{returnnil,fmt.Errorf("talent.NewCompletionClient: %w",err)}deferc.Close()// Construct a completeQuery request.req:=&talentpb.CompleteQueryRequest{Parent:fmt.Sprintf("projects/%s",projectID),Query:query,LanguageCodes:[]string{"en-US"},PageSize:5,// Number of completion results returned.Scope:talentpb.CompleteQueryRequest_PUBLIC,Type:talentpb.CompleteQueryRequest_JOB_TITLE,}resp,err:=c.CompleteQuery(ctx,req)iferr!=nil{returnnil,fmt.Errorf("CompleteQuery(%s): %w",query,err)}fmt.Fprintf(w,"Auto complete results:")for_,c:=rangeresp.GetCompletionResults(){fmt.Fprintf(w,"\t%v\n",c.Suggestion)}returnresp,nil}
importcom.google.cloud.talent.v4beta1.CompleteQueryRequest;importcom.google.cloud.talent.v4beta1.CompleteQueryResponse;importcom.google.cloud.talent.v4beta1.CompletionClient;importcom.google.cloud.talent.v4beta1.TenantName;importjava.io.IOException;publicclassJobSearchAutoCompleteJobTitle{publicstaticvoidcompleteQuery()throwsIOException{// TODO(developer): Replace these variables before running the sample.StringprojectId="your-project-id";StringtenantId="your-tenant-id";Stringquery="your-query-for-job-title";completeQuery(projectId,tenantId,query);}// Complete job title given partial text (autocomplete).publicstaticvoidcompleteQuery(StringprojectId,StringtenantId,Stringquery)throwsIOException{// 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(CompletionClientcompletionClient=CompletionClient.create()){TenantNameparent=TenantName.of(projectId,tenantId);CompleteQueryRequestrequest=CompleteQueryRequest.newBuilder().setParent(parent.toString()).setQuery(query).setPageSize(5)// limit for number of results.addLanguageCodes("en-US")// language code.build();CompleteQueryResponseresponse=completionClient.completeQuery(request);for(CompleteQueryResponse.CompletionResultresult:response.getCompletionResultsList()){System.out.format("Suggested title: %s%n",result.getSuggestion());// Suggestion type is JOB_TITLE or COMPANY_TITLESystem.out.format("Suggestion type: %s%n",result.getType());}}}}
fromgoogle.cloudimporttalent_v4beta1defcomplete_query(project_id,tenant_id,query):"""Complete job title given partial text (autocomplete)"""client=talent_v4beta1.CompletionClient()# project_id = 'Your Google Cloud Project ID'# tenant_id = 'Your Tenant ID (using tenancy is optional)'# query = '[partially typed job title]'ifisinstance(project_id,bytes):project_id=project_id.decode("utf-8")ifisinstance(tenant_id,bytes):tenant_id=tenant_id.decode("utf-8")ifisinstance(query,bytes):query=query.decode("utf-8")parent=f"projects/{project_id}/tenants/{tenant_id}"request=talent_v4beta1.CompleteQueryRequest(parent=parent,query=query,page_size=5,# limit for number of resultslanguage_codes=["en-US"],# language code)response=client.complete_query(request=request)forresultinresponse.completion_results:print(f"Suggested title: {result.suggestion}")# Suggestion type is JOB_TITLE or COMPANY_TITLEprint(f"Suggestion type: {talent_v4beta1.CompleteQueryRequest.CompletionType(result.type_).name}")
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Autocomplete (v4beta1)\n\nCloud Talent Solution provides autocomplete suggestions for job titles and\ncompany names. Only active job postings and companies with at least one open\njob are considered eligible for suggestion results. Once a new job or company\nis added, it takes up to 48 hours for the information to be added to the\nautocomplete result set.\n\nTo use autocomplete, call the [`complete`](/talent-solution/job-search/v4beta1/docs/reference/rest/v4beta1/projects/complete) method when the search bar is updated.\n**Note:** Language codes must be specified using the [BCP-47](https://tools.ietf.org/html/bcp47) identifier. For example: `en-US` or `zh-TW`. Do not use abbreviated language codes such as `en` or `zh`. \n\n### Go\n\n\nTo learn how to install and use the client library for CTS, see\n[CTS client libraries](/talent-solution/job-search/docs/libraries).\n\n\nFor more information, see the\n[CTS Go API\nreference documentation](/go/docs/reference/cloud.google.com/go/talent/latest/apiv4).\n\n\nTo authenticate to CTS, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n import (\n \t\"context\"\n \t\"fmt\"\n \t\"io\"\n\n \ttalent \"cloud.google.com/go/talent/apiv4beta1\"\n \t\"cloud.google.com/go/talent/apiv4beta1/talentpb\"\n )\n\n // jobTitleAutoComplete suggests the job titles of the given\n // company identifier on query.\n func jobTitleAutocomplete(w io.Writer, projectID, query string) (*talentpb.CompleteQueryResponse, error) {\n \tctx := context.Background()\n\n \t// Initialize a completionService client.\n \tc, err := talent.NewCompletionClient(ctx)\n \tif err != nil {\n \t\treturn nil, fmt.Errorf(\"talent.NewCompletionClient: %w\", err)\n \t}\n \tdefer c.Close()\n\n \t// Construct a completeQuery request.\n \treq := &talentpb.CompleteQueryRequest{\n \t\tParent: fmt.Sprintf(\"projects/%s\", projectID),\n \t\tQuery: query,\n \t\tLanguageCodes: []string{\"en-US\"},\n \t\tPageSize: 5, // Number of completion results returned.\n \t\tScope: talentpb.https://cloud.google.com/go/docs/reference/cloud.google.com/go/talent/latest/apiv4beta1/talentpb.html#cloud_google_com_go_talent_apiv4beta1_talentpb_CompleteQueryRequest_COMPLETION_SCOPE_UNSPECIFIED_CompleteQueryRequest_TENANT_CompleteQueryRequest_PUBLIC,\n \t\tType: talentpb.https://cloud.google.com/go/docs/reference/cloud.google.com/go/talent/latest/apiv4beta1/talentpb.html#cloud_google_com_go_talent_apiv4beta1_talentpb_CompleteQueryRequest_COMPLETION_TYPE_UNSPECIFIED_CompleteQueryRequest_JOB_TITLE_CompleteQueryRequest_COMPANY_NAME_CompleteQueryRequest_COMBINED,\n \t}\n\n \tresp, err := c.CompleteQuery(ctx, req)\n \tif err != nil {\n \t\treturn nil, fmt.Errorf(\"CompleteQuery(%s): %w\", query, err)\n \t}\n\n \tfmt.Fprintf(w, \"Auto complete results:\")\n \tfor _, c := range resp.GetCompletionResults() {\n \t\tfmt.Fprintf(w, \"\\t%v\\n\", c.Suggestion)\n \t}\n\n \treturn resp, nil\n }\n\n### Java\n\n\nFor more on installing and creating a Cloud Talent Solution client, see\n[Cloud Talent Solution Client Libraries](/talent-solution/job-search/v4beta1/docs/libraries). \n\n\n import com.google.cloud.talent.v4beta1.CompleteQueryRequest;\n import com.google.cloud.talent.v4beta1.CompleteQueryResponse;\n import com.google.cloud.talent.v4beta1.CompletionClient;\n import com.google.cloud.talent.v4beta1.TenantName;\n import java.io.IOException;\n\n public class JobSearchAutoCompleteJobTitle {\n\n public static void completeQuery() throws IOException {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"your-project-id\";\n String tenantId = \"your-tenant-id\";\n String query = \"your-query-for-job-title\";\n completeQuery(projectId, tenantId, query);\n }\n\n // Complete job title given partial text (autocomplete).\n public static void completeQuery(String projectId, String tenantId, String query)\n throws IOException {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests. After completing all of your requests, call\n // the \"close\" method on the client to safely clean up any remaining background resources.\n try (CompletionClient completionClient = CompletionClient.create()) {\n TenantName parent = TenantName.of(projectId, tenantId);\n CompleteQueryRequest request =\n CompleteQueryRequest.newBuilder()\n .setParent(parent.toString())\n .setQuery(query)\n .setPageSize(5) // limit for number of results\n .addLanguageCodes(\"en-US\") // language code\n .build();\n CompleteQueryResponse response = completionClient.completeQuery(request);\n for (CompleteQueryResponse.CompletionResult result : response.getCompletionResultsList()) {\n System.out.format(\"Suggested title: %s%n\", result.getSuggestion());\n // Suggestion type is JOB_TITLE or COMPANY_TITLE\n System.out.format(\"Suggestion type: %s%n\", result.getType());\n }\n }\n }\n }\n\n### Python\n\n\nFor more on installing and creating a Cloud Talent Solution client, see\n[Cloud Talent Solution Client Libraries](/talent-solution/job-search/v4beta1/docs/libraries). \n\n\n from google.cloud import talent_v4beta1\n\n\n def complete_query(project_id, tenant_id, query):\n \"\"\"Complete job title given partial text (autocomplete)\"\"\"\n\n client = talent_v4beta1.https://cloud.google.com/python/docs/reference/talent/latest/google.cloud.talent_v4beta1.services.completion.CompletionClient.html()\n\n # project_id = 'Your Google Cloud Project ID'\n # tenant_id = 'Your Tenant ID (using tenancy is optional)'\n # query = '[partially typed job title]'\n\n if isinstance(project_id, bytes):\n project_id = project_id.decode(\"utf-8\")\n if isinstance(tenant_id, bytes):\n tenant_id = tenant_id.decode(\"utf-8\")\n if isinstance(query, bytes):\n query = query.decode(\"utf-8\")\n\n parent = f\"projects/{project_id}/tenants/{tenant_id}\"\n\n request = talent_v4beta1.https://cloud.google.com/python/docs/reference/talent/latest/google.cloud.talent_v4beta1.types.CompleteQueryRequest.html(\n parent=parent,\n query=query,\n page_size=5, # limit for number of results\n language_codes=[\"en-US\"], # language code\n )\n response = client.https://cloud.google.com/python/docs/reference/talent/latest/google.cloud.talent_v4beta1.services.completion.CompletionClient.html#google_cloud_talent_v4beta1_services_completion_CompletionClient_complete_query(request=request)\n for result in response.completion_results:\n print(f\"Suggested title: {result.suggestion}\")\n # Suggestion type is JOB_TITLE or COMPANY_TITLE\n print(\n f\"Suggestion type: {talent_v4beta1.https://cloud.google.com/python/docs/reference/talent/latest/google.cloud.talent_v4beta1.types.CompleteQueryRequest.html.https://cloud.google.com/python/docs/reference/talent/latest/google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType.html(result.type_).name}\"\n )\n\n\u003cbr /\u003e"]]