דירוג בהתאמה אישית (גרסה v4beta1)

התכונה 'דירוג בהתאמה אישית' מאפשרת לכם להוסיף לוגיקה עסקית משלכם כדי לשלוט בדירוג המשרות שמוחזרות על ידי Cloud Talent Solution. מחפשי עבודה שמחפשים באתר יכולים להגדיר את שאילתת החיפוש ומסננים אחרים כ'תמיד', ואתם יכולים להוסיף ביטוי דירוג לבקשת החיפוש. ‫Cloud Talent Solution קובע את המשרות הרלוונטיות לשאילתה שהוגדרה על ידי מחפש העבודה, ומדרג את התוצאות על סמך ביטוי הדירוג המותאם אישית. לאחר מכן הרשימה המדורגת הזו מוחזרת אליכם כדי שתוכלו להציג אותה למועמדים. כאן אפשר לצפות בסרטון הדרכה על הטמעה של דירוג מותאם אישית.

יתרונות

דירוג מותאם אישית מאפשר לכם לקבוע איך התוצאות יוצגו. שימוש בדירוג מותאם אישית מאפשר לכם להגדיר משקלים שאפשר להקצות למאפיינים מותאמים אישית. אפשר להשתמש בשילוב של משקלים ומאפיינים מותאמים אישית כדי ליצור ביטוי דירוג מותאם אישית שיקבע את סדר התוצאות שיוחזרו.

הדירוג המותאם אישית מבוסס על שירות החיפוש הקיים. הוא מתבסס על הערכים שסופקו בכל שילוב מוגדר על ידי הלקוח של המאפיינים המותאמים אישית.

תרחיש שימוש לדוגמה

משתמש הקצה מחפש 'מהנדס תוכנה'. העסק רוצה להציג כרטיסי מוצר עם שיעורי המרה גבוהים יותר למונח 'מהנדס תוכנה'. שימוש בדירוג מותאם אישית מאפשר לכם להציב ערך לכרטיסי המוצר האלה ולהציג אותם למשתמש הקצה בסדר שנקבע על ידי הביטוי של הדירוג המותאם אישית.

לדוגמה, יש לכם שני כרטיסי מוצר כמעט זהים למשרות, אבל לכרטיס מוצר למשרה א' יש ערך עלות גבוה יותר לקליק (CPC) מאשר לכרטיס מוצר למשרה ב'. אתם יכולים להשתמש בדירוג בהתאמה אישית כדי להגדיל את החשיפה של משרה א' על ידי התאמת הדירוג של מאפיין העלות לקליק בהתאמה אישית באמצעות משקלים.

אופן השימוש

הדירוג המותאם אישית תומך באופרטורים המתמטיים הבאים: +, -, *, /, (, )

אתם יכולים להשתמש בשמות השדות של מאפיינים מותאמים אישית ובאופרטורים המתמטיים האלה כדי להגדיר ביטוי דירוג בהתאמה אישית.

לדוגמה, נניח שיש לכם שני מאפיינים מותאמים אישית: עלות לקליק ועדכניות, כאשר עדכניות היא מספר הימים מאז פרסום המשרה. אתם רוצים לדרג משרות לפי עלות לקליק ועדכניות, כאשר עלות לקליק מהווה 75% מהדירוג ועדכניות מהווה 25%. כדי ליצור ביטוי דירוג בהתאמה אישית:

(0.75*CPC) + (0.25 *Freshness)

קוד לדוגמה

בדוגמה הבאה נוצר ביטוי דירוג מותאם אישית באמצעות שני מאפיינים מותאמים אישית, cpc_value ו-freshness_value. היא מגדירה את ביטוי הדירוג המותאם אישית ל-(cpc_value / 2) - freshness_value.

Go

מידע על התקנת ספריית הלקוח של CTS ושימוש בה מופיע במאמר ספריות הלקוח של CTS. מידע נוסף מופיע במאמרי העזרה של CTS Go API.

כדי לבצע אימות ב-CTS, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"cloud.google.com/go/talent/apiv4beta1/talentpb"
)

// customRankingSearch searches for jobs based on custom ranking.
func customRankingSearch(w io.Writer, projectID, companyID string) error {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		return fmt.Errorf("taleng.NewJobClient: %w", err)
	}
	defer c.Close()

	// Construct a searchJobs request.
	req := &talentpb.SearchJobsRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		// Make sure to set the RequestMetadata the same as the associated
		// search request.
		RequestMetadata: &talentpb.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",
		},
		JobQuery: &talentpb.JobQuery{
			Companies: []string{fmt.Sprintf("projects/%s/companies/%s", projectID, companyID)},
		},
		// More info on customRankingInfo.
		// https://godoc.org/google.golang.org/genproto/googleapis/cloud/talent/v4beta1#SearchJobsRequest_CustomRankingInfo
		CustomRankingInfo: &talentpb.SearchJobsRequest_CustomRankingInfo{
			ImportanceLevel:   talentpb.SearchJobsRequest_CustomRankingInfo_EXTREME,
			RankingExpression: "(someFieldLong + 25) * 0.25",
		},
		OrderBy: "custom_ranking desc",
	}

	resp, err := c.SearchJobs(ctx, req)
	if err != nil {
		return fmt.Errorf("SearchJobs: %w", err)
	}

	for _, job := range resp.GetMatchingJobs() {
		fmt.Fprintf(w, "Job: %q\n", job.GetJob().GetName())
	}

	return nil
}

Java

מידע נוסף על התקנה ויצירה של לקוח Cloud Talent Solution זמין במאמר ספריות לקוח של Cloud Talent Solution.


import com.google.cloud.talent.v4beta1.Job;
import com.google.cloud.talent.v4beta1.JobServiceClient;
import com.google.cloud.talent.v4beta1.RequestMetadata;
import com.google.cloud.talent.v4beta1.SearchJobsRequest;
import com.google.cloud.talent.v4beta1.SearchJobsResponse;
import com.google.cloud.talent.v4beta1.TenantName;
import java.io.IOException;

public class CustomRankingSearchJobs {

  public static void searchCustomRankingJobs() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    searchCustomRankingJobs(projectId, tenantId);
  }

  // Search Jobs using custom rankings.
  public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException {
    // 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);
      String domain = "www.example.com";
      String sessionId = "Hashed session identifier";
      String userId = "Hashed user identifier";
      RequestMetadata requestMetadata =
          RequestMetadata.newBuilder()
              .setDomain(domain)
              .setSessionId(sessionId)
              .setUserId(userId)
              .build();
      SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel =
          SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME;
      String rankingExpression = "(someFieldLong + 25) * 0.25";
      SearchJobsRequest.CustomRankingInfo customRankingInfo =
          SearchJobsRequest.CustomRankingInfo.newBuilder()
              .setImportanceLevel(importanceLevel)
              .setRankingExpression(rankingExpression)
              .build();
      String orderBy = "custom_ranking desc";
      SearchJobsRequest request =
          SearchJobsRequest.newBuilder()
              .setParent(parent.toString())
              .setRequestMetadata(requestMetadata)
              .setCustomRankingInfo(customRankingInfo)
              .setOrderBy(orderBy)
              .build();
      for (SearchJobsResponse.MatchingJob responseItem :
          jobServiceClient.searchJobs(request).iterateAll()) {
        System.out.format("Job summary: %s%n", responseItem.getJobSummary());
        System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet());
        Job job = responseItem.getJob();
        System.out.format("Job name: %s%n", job.getName());
        System.out.format("Job title: %s%n", job.getTitle());
      }
    }
  }
}

Python

מידע נוסף על התקנה ויצירה של לקוח Cloud Talent Solution זמין במאמר ספריות לקוח של Cloud Talent Solution.

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from google.cloud import talent


def search_jobs(project_id, tenant_id):
    """Search Jobs using custom rankings"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    parent = f"projects/{project_id}/tenants/{tenant_id}"
    domain = "www.example.com"
    session_id = "Hashed session identifier"
    user_id = "Hashed user identifier"
    request_metadata = talent.RequestMetadata(
        domain=domain, session_id=session_id, user_id=user_id
    )
    importance_level = (
        talent.SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME
    )
    ranking_expression = "(someFieldLong + 25) * 0.25"
    custom_ranking_info = {
        "importance_level": importance_level,
        "ranking_expression": ranking_expression,
    }
    order_by = "custom_ranking desc"

    # Iterate over all results
    results = []
    request = talent.SearchJobsRequest(
        parent=parent,
        request_metadata=request_metadata,
        custom_ranking_info=custom_ranking_info,
        order_by=order_by,
    )
    for response_item in client.search_jobs(request=request).matching_jobs:
        print(f"Job summary: {response_item.job_summary}")
        print(f"Job title snippet: {response_item.job_title_snippet}")
        job = response_item.job
        results.append(job.name)
        print(f"Job name: {job.name}")
        print(f"Job title: {job.title}")
    return results