@google-cloud/discoveryengine 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +152 -0
- package/build/protos/google/cloud/discoveryengine/v1alpha/search_service.proto +128 -4
- package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +128 -4
- package/build/protos/protos.d.ts +825 -0
- package/build/protos/protos.js +2438 -0
- package/build/protos/protos.json +517 -0
- package/build/src/v1/identity_mapping_store_service_client.js +5 -5
- package/build/src/v1/search_service_client.d.ts +558 -0
- package/build/src/v1/search_service_client.js +372 -0
- package/build/src/v1alpha/search_service_client.d.ts +210 -12
- package/build/src/v1alpha/search_service_client.js +140 -8
- package/build/src/v1beta/search_service_client.d.ts +420 -24
- package/build/src/v1beta/search_service_client.js +280 -16
- package/package.json +1 -1
package/README.md
CHANGED
@@ -502,3 +502,6 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
|
|
502
502
|
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
|
503
503
|
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=discoveryengine.googleapis.com
|
504
504
|
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
|
505
|
+
|
506
|
+
|
507
|
+
[//]: # "partials.introduction"
|
@@ -1069,6 +1069,115 @@ message SearchRequest {
|
|
1069
1069
|
// Optional. The specification for returning the relevance score.
|
1070
1070
|
RelevanceScoreSpec relevance_score_spec = 52
|
1071
1071
|
[(google.api.field_behavior) = OPTIONAL];
|
1072
|
+
|
1073
|
+
// The ranking expression controls the customized ranking on retrieval
|
1074
|
+
// documents. This overrides
|
1075
|
+
// [ServingConfig.ranking_expression][google.cloud.discoveryengine.v1.ServingConfig.ranking_expression].
|
1076
|
+
// The syntax and supported features depend on the
|
1077
|
+
// `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
1078
|
+
// provided, it defaults to `RANK_BY_EMBEDDING`.
|
1079
|
+
//
|
1080
|
+
// If
|
1081
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend]
|
1082
|
+
// is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
1083
|
+
// function or multiple functions that are joined by "+".
|
1084
|
+
//
|
1085
|
+
// * ranking_expression = function, { " + ", function };
|
1086
|
+
//
|
1087
|
+
// Supported functions:
|
1088
|
+
//
|
1089
|
+
// * double * relevance_score
|
1090
|
+
// * double * dotProduct(embedding_field_path)
|
1091
|
+
//
|
1092
|
+
// Function variables:
|
1093
|
+
//
|
1094
|
+
// * `relevance_score`: pre-defined keywords, used for measure relevance
|
1095
|
+
// between query and document.
|
1096
|
+
// * `embedding_field_path`: the document embedding field
|
1097
|
+
// used with query embedding vector.
|
1098
|
+
// * `dotProduct`: embedding function between `embedding_field_path` and
|
1099
|
+
// query embedding vector.
|
1100
|
+
//
|
1101
|
+
// Example ranking expression:
|
1102
|
+
//
|
1103
|
+
// If document has an embedding field doc_embedding, the ranking expression
|
1104
|
+
// could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1105
|
+
//
|
1106
|
+
// If
|
1107
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend]
|
1108
|
+
// is set to `RANK_BY_FORMULA`, the following expression types (and
|
1109
|
+
// combinations of those chained using + or
|
1110
|
+
// * operators) are supported:
|
1111
|
+
//
|
1112
|
+
// * `double`
|
1113
|
+
// * `signal`
|
1114
|
+
// * `log(signal)`
|
1115
|
+
// * `exp(signal)`
|
1116
|
+
// * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1117
|
+
// argument being a denominator constant.
|
1118
|
+
// * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1119
|
+
// * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1120
|
+
// signal2 | double, else returns signal1.
|
1121
|
+
//
|
1122
|
+
// Here are a few examples of ranking formulas that use the supported
|
1123
|
+
// ranking expression types:
|
1124
|
+
//
|
1125
|
+
// - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1126
|
+
// -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1127
|
+
// `semantic_smilarity_score` adjustment.
|
1128
|
+
// - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1129
|
+
// is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1130
|
+
// `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1131
|
+
// add constant 0.3 adjustment to the final score if
|
1132
|
+
// `semantic_similarity_score` is NaN.
|
1133
|
+
// - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1134
|
+
// rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1135
|
+
// of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1136
|
+
// of `semantic_smilarity_score`.
|
1137
|
+
//
|
1138
|
+
// The following signals are supported:
|
1139
|
+
//
|
1140
|
+
// * `semantic_similarity_score`: semantic similarity adjustment that is
|
1141
|
+
// calculated using the embeddings generated by a proprietary Google model.
|
1142
|
+
// This score determines how semantically similar a search query is to a
|
1143
|
+
// document.
|
1144
|
+
// * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1145
|
+
// Match 25 (BM25) ranking function. This score is calculated using a
|
1146
|
+
// probabilistic model to estimate the probability that a document is
|
1147
|
+
// relevant to a given query.
|
1148
|
+
// * `relevance_score`: semantic relevance adjustment that uses a
|
1149
|
+
// proprietary Google model to determine the meaning and intent behind a
|
1150
|
+
// user's query in context with the content in the documents.
|
1151
|
+
// * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1152
|
+
// predicted Click-through rate (pCTR) to gauge the relevance and
|
1153
|
+
// attractiveness of a search result from a user's perspective. A higher
|
1154
|
+
// pCTR suggests that the result is more likely to satisfy the user's query
|
1155
|
+
// and intent, making it a valuable signal for ranking.
|
1156
|
+
// * `freshness_rank`: freshness adjustment as a rank
|
1157
|
+
// * `document_age`: The time in hours elapsed since the document was last
|
1158
|
+
// updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1159
|
+
// * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1160
|
+
// Google model to determine the keyword-based overlap between the query and
|
1161
|
+
// the document.
|
1162
|
+
// * `base_rank`: the default rank of the result
|
1163
|
+
string ranking_expression = 26;
|
1164
|
+
|
1165
|
+
// The backend to use for the ranking expression evaluation.
|
1166
|
+
enum RankingExpressionBackend {
|
1167
|
+
reserved 1, 2;
|
1168
|
+
|
1169
|
+
// Default option for unspecified/unknown values.
|
1170
|
+
RANKING_EXPRESSION_BACKEND_UNSPECIFIED = 0;
|
1171
|
+
// Ranking by custom embedding model, the default way to evaluate the
|
1172
|
+
// ranking expression.
|
1173
|
+
RANK_BY_EMBEDDING = 3;
|
1174
|
+
// Ranking by custom formula.
|
1175
|
+
RANK_BY_FORMULA = 4;
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
// The backend to use for the ranking expression evaluation.
|
1179
|
+
RankingExpressionBackend ranking_expression_backend = 53
|
1180
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1072
1181
|
}
|
1073
1182
|
|
1074
1183
|
// Response message for
|
@@ -1094,6 +1203,49 @@ message SearchResponse {
|
|
1094
1203
|
// Output only. Google provided available scores.
|
1095
1204
|
map<string, DoubleList> model_scores = 4
|
1096
1205
|
[(google.api.field_behavior) = OUTPUT_ONLY];
|
1206
|
+
|
1207
|
+
// A set of ranking signals.
|
1208
|
+
message RankSignals {
|
1209
|
+
reserved 5;
|
1210
|
+
|
1211
|
+
// Keyword matching adjustment.
|
1212
|
+
optional float keyword_similarity_score = 1
|
1213
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1214
|
+
// Semantic relevance adjustment.
|
1215
|
+
optional float relevance_score = 2
|
1216
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1217
|
+
// Semantic similarity adjustment.
|
1218
|
+
optional float semantic_similarity_score = 3
|
1219
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1220
|
+
// Predicted conversion rate adjustment as a rank.
|
1221
|
+
optional float pctr_rank = 4 [(google.api.field_behavior) = OPTIONAL];
|
1222
|
+
// Topicality adjustment as a rank.
|
1223
|
+
optional float topicality_rank = 6
|
1224
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1225
|
+
// Age of the document in hours.
|
1226
|
+
optional float document_age = 7 [(google.api.field_behavior) = OPTIONAL];
|
1227
|
+
// Combined custom boosts for a doc.
|
1228
|
+
optional float boosting_factor = 8
|
1229
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1230
|
+
|
1231
|
+
// The default rank of the result.
|
1232
|
+
float default_rank = 32 [(google.api.field_behavior) = OPTIONAL];
|
1233
|
+
|
1234
|
+
// Custom clearbox signal represented by name and value pair.
|
1235
|
+
message CustomSignal {
|
1236
|
+
// Name of the signal.
|
1237
|
+
string name = 1 [(google.api.field_behavior) = OPTIONAL];
|
1238
|
+
// Float value representing the ranking signal (e.g. 1.25 for BM25).
|
1239
|
+
float value = 2 [(google.api.field_behavior) = OPTIONAL];
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
// A list of custom clearbox signals.
|
1243
|
+
repeated CustomSignal custom_signals = 33
|
1244
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
// A set of ranking signals associated with the result.
|
1248
|
+
RankSignals rank_signals = 7 [(google.api.field_behavior) = OPTIONAL];
|
1097
1249
|
}
|
1098
1250
|
|
1099
1251
|
// A facet result.
|
@@ -966,8 +966,14 @@ message SearchRequest {
|
|
966
966
|
// The ranking expression controls the customized ranking on retrieval
|
967
967
|
// documents. This overrides
|
968
968
|
// [ServingConfig.ranking_expression][google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression].
|
969
|
-
// The
|
970
|
-
//
|
969
|
+
// The syntax and supported features depend on the
|
970
|
+
// `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
971
|
+
// provided, it defaults to `RANK_BY_EMBEDDING`.
|
972
|
+
//
|
973
|
+
// If
|
974
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend]
|
975
|
+
// is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
976
|
+
// function or multiple functions that are joined by "+".
|
971
977
|
//
|
972
978
|
// * ranking_expression = function, { " + ", function };
|
973
979
|
//
|
@@ -982,15 +988,90 @@ message SearchRequest {
|
|
982
988
|
// between query and document.
|
983
989
|
// * `embedding_field_path`: the document embedding field
|
984
990
|
// used with query embedding vector.
|
985
|
-
// * `dotProduct`: embedding function between embedding_field_path and
|
986
|
-
// embedding vector.
|
991
|
+
// * `dotProduct`: embedding function between `embedding_field_path` and
|
992
|
+
// query embedding vector.
|
987
993
|
//
|
988
994
|
// Example ranking expression:
|
989
995
|
//
|
990
996
|
// If document has an embedding field doc_embedding, the ranking expression
|
991
997
|
// could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
998
|
+
//
|
999
|
+
// If
|
1000
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend]
|
1001
|
+
// is set to `RANK_BY_FORMULA`, the following expression types (and
|
1002
|
+
// combinations of those chained using + or
|
1003
|
+
// * operators) are supported:
|
1004
|
+
//
|
1005
|
+
// * `double`
|
1006
|
+
// * `signal`
|
1007
|
+
// * `log(signal)`
|
1008
|
+
// * `exp(signal)`
|
1009
|
+
// * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1010
|
+
// argument being a denominator constant.
|
1011
|
+
// * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1012
|
+
// * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1013
|
+
// signal2 | double, else returns signal1.
|
1014
|
+
//
|
1015
|
+
// Here are a few examples of ranking formulas that use the supported
|
1016
|
+
// ranking expression types:
|
1017
|
+
//
|
1018
|
+
// - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1019
|
+
// -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1020
|
+
// `semantic_smilarity_score` adjustment.
|
1021
|
+
// - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1022
|
+
// is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1023
|
+
// `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1024
|
+
// add constant 0.3 adjustment to the final score if
|
1025
|
+
// `semantic_similarity_score` is NaN.
|
1026
|
+
// - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1027
|
+
// rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1028
|
+
// of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1029
|
+
// of `semantic_smilarity_score`.
|
1030
|
+
//
|
1031
|
+
// The following signals are supported:
|
1032
|
+
//
|
1033
|
+
// * `semantic_similarity_score`: semantic similarity adjustment that is
|
1034
|
+
// calculated using the embeddings generated by a proprietary Google model.
|
1035
|
+
// This score determines how semantically similar a search query is to a
|
1036
|
+
// document.
|
1037
|
+
// * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1038
|
+
// Match 25 (BM25) ranking function. This score is calculated using a
|
1039
|
+
// probabilistic model to estimate the probability that a document is
|
1040
|
+
// relevant to a given query.
|
1041
|
+
// * `relevance_score`: semantic relevance adjustment that uses a
|
1042
|
+
// proprietary Google model to determine the meaning and intent behind a
|
1043
|
+
// user's query in context with the content in the documents.
|
1044
|
+
// * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1045
|
+
// predicted Click-through rate (pCTR) to gauge the relevance and
|
1046
|
+
// attractiveness of a search result from a user's perspective. A higher
|
1047
|
+
// pCTR suggests that the result is more likely to satisfy the user's query
|
1048
|
+
// and intent, making it a valuable signal for ranking.
|
1049
|
+
// * `freshness_rank`: freshness adjustment as a rank
|
1050
|
+
// * `document_age`: The time in hours elapsed since the document was last
|
1051
|
+
// updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1052
|
+
// * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1053
|
+
// Google model to determine the keyword-based overlap between the query and
|
1054
|
+
// the document.
|
1055
|
+
// * `base_rank`: the default rank of the result
|
992
1056
|
string ranking_expression = 26;
|
993
1057
|
|
1058
|
+
// The backend to use for the ranking expression evaluation.
|
1059
|
+
enum RankingExpressionBackend {
|
1060
|
+
reserved 1, 2;
|
1061
|
+
|
1062
|
+
// Default option for unspecified/unknown values.
|
1063
|
+
RANKING_EXPRESSION_BACKEND_UNSPECIFIED = 0;
|
1064
|
+
// Ranking by custom embedding model, the default way to evaluate the
|
1065
|
+
// ranking expression.
|
1066
|
+
RANK_BY_EMBEDDING = 3;
|
1067
|
+
// Ranking by custom formula.
|
1068
|
+
RANK_BY_FORMULA = 4;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
// The backend to use for the ranking expression evaluation.
|
1072
|
+
RankingExpressionBackend ranking_expression_backend = 53
|
1073
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1074
|
+
|
994
1075
|
// Whether to turn on safe search. This is only supported for
|
995
1076
|
// website search.
|
996
1077
|
bool safe_search = 20;
|
@@ -1088,6 +1169,49 @@ message SearchResponse {
|
|
1088
1169
|
|
1089
1170
|
// Google provided available scores.
|
1090
1171
|
map<string, DoubleList> model_scores = 4;
|
1172
|
+
|
1173
|
+
// A set of ranking signals.
|
1174
|
+
message RankSignals {
|
1175
|
+
reserved 5;
|
1176
|
+
|
1177
|
+
// Keyword matching adjustment.
|
1178
|
+
optional float keyword_similarity_score = 1
|
1179
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1180
|
+
// Semantic relevance adjustment.
|
1181
|
+
optional float relevance_score = 2
|
1182
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1183
|
+
// Semantic similarity adjustment.
|
1184
|
+
optional float semantic_similarity_score = 3
|
1185
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1186
|
+
// Predicted conversion rate adjustment as a rank.
|
1187
|
+
optional float pctr_rank = 4 [(google.api.field_behavior) = OPTIONAL];
|
1188
|
+
// Topicality adjustment as a rank.
|
1189
|
+
optional float topicality_rank = 6
|
1190
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1191
|
+
// Age of the document in hours.
|
1192
|
+
optional float document_age = 7 [(google.api.field_behavior) = OPTIONAL];
|
1193
|
+
// Combined custom boosts for a doc.
|
1194
|
+
optional float boosting_factor = 8
|
1195
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1196
|
+
|
1197
|
+
// The default rank of the result.
|
1198
|
+
float default_rank = 32 [(google.api.field_behavior) = OPTIONAL];
|
1199
|
+
|
1200
|
+
// Custom clearbox signal represented by name and value pair.
|
1201
|
+
message CustomSignal {
|
1202
|
+
// Name of the signal.
|
1203
|
+
string name = 1 [(google.api.field_behavior) = OPTIONAL];
|
1204
|
+
// Float value representing the ranking signal (e.g. 1.25 for BM25).
|
1205
|
+
float value = 2 [(google.api.field_behavior) = OPTIONAL];
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
// A list of custom clearbox signals.
|
1209
|
+
repeated CustomSignal custom_signals = 33
|
1210
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
// A set of ranking signals associated with the result.
|
1214
|
+
RankSignals rank_signals = 7 [(google.api.field_behavior) = OPTIONAL];
|
1091
1215
|
}
|
1092
1216
|
|
1093
1217
|
// A facet result.
|
@@ -1038,8 +1038,14 @@ message SearchRequest {
|
|
1038
1038
|
// The ranking expression controls the customized ranking on retrieval
|
1039
1039
|
// documents. This overrides
|
1040
1040
|
// [ServingConfig.ranking_expression][google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression].
|
1041
|
-
// The
|
1042
|
-
//
|
1041
|
+
// The syntax and supported features depend on the
|
1042
|
+
// `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
1043
|
+
// provided, it defaults to `RANK_BY_EMBEDDING`.
|
1044
|
+
//
|
1045
|
+
// If
|
1046
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend]
|
1047
|
+
// is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
1048
|
+
// function or multiple functions that are joined by "+".
|
1043
1049
|
//
|
1044
1050
|
// * ranking_expression = function, { " + ", function };
|
1045
1051
|
//
|
@@ -1054,15 +1060,90 @@ message SearchRequest {
|
|
1054
1060
|
// between query and document.
|
1055
1061
|
// * `embedding_field_path`: the document embedding field
|
1056
1062
|
// used with query embedding vector.
|
1057
|
-
// * `dotProduct`: embedding function between embedding_field_path and
|
1058
|
-
// embedding vector.
|
1063
|
+
// * `dotProduct`: embedding function between `embedding_field_path` and
|
1064
|
+
// query embedding vector.
|
1059
1065
|
//
|
1060
1066
|
// Example ranking expression:
|
1061
1067
|
//
|
1062
1068
|
// If document has an embedding field doc_embedding, the ranking expression
|
1063
1069
|
// could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1070
|
+
//
|
1071
|
+
// If
|
1072
|
+
// [ranking_expression_backend][google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend]
|
1073
|
+
// is set to `RANK_BY_FORMULA`, the following expression types (and
|
1074
|
+
// combinations of those chained using + or
|
1075
|
+
// * operators) are supported:
|
1076
|
+
//
|
1077
|
+
// * `double`
|
1078
|
+
// * `signal`
|
1079
|
+
// * `log(signal)`
|
1080
|
+
// * `exp(signal)`
|
1081
|
+
// * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1082
|
+
// argument being a denominator constant.
|
1083
|
+
// * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1084
|
+
// * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1085
|
+
// signal2 | double, else returns signal1.
|
1086
|
+
//
|
1087
|
+
// Here are a few examples of ranking formulas that use the supported
|
1088
|
+
// ranking expression types:
|
1089
|
+
//
|
1090
|
+
// - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1091
|
+
// -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1092
|
+
// `semantic_smilarity_score` adjustment.
|
1093
|
+
// - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1094
|
+
// is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1095
|
+
// `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1096
|
+
// add constant 0.3 adjustment to the final score if
|
1097
|
+
// `semantic_similarity_score` is NaN.
|
1098
|
+
// - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1099
|
+
// rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1100
|
+
// of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1101
|
+
// of `semantic_smilarity_score`.
|
1102
|
+
//
|
1103
|
+
// The following signals are supported:
|
1104
|
+
//
|
1105
|
+
// * `semantic_similarity_score`: semantic similarity adjustment that is
|
1106
|
+
// calculated using the embeddings generated by a proprietary Google model.
|
1107
|
+
// This score determines how semantically similar a search query is to a
|
1108
|
+
// document.
|
1109
|
+
// * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1110
|
+
// Match 25 (BM25) ranking function. This score is calculated using a
|
1111
|
+
// probabilistic model to estimate the probability that a document is
|
1112
|
+
// relevant to a given query.
|
1113
|
+
// * `relevance_score`: semantic relevance adjustment that uses a
|
1114
|
+
// proprietary Google model to determine the meaning and intent behind a
|
1115
|
+
// user's query in context with the content in the documents.
|
1116
|
+
// * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1117
|
+
// predicted Click-through rate (pCTR) to gauge the relevance and
|
1118
|
+
// attractiveness of a search result from a user's perspective. A higher
|
1119
|
+
// pCTR suggests that the result is more likely to satisfy the user's query
|
1120
|
+
// and intent, making it a valuable signal for ranking.
|
1121
|
+
// * `freshness_rank`: freshness adjustment as a rank
|
1122
|
+
// * `document_age`: The time in hours elapsed since the document was last
|
1123
|
+
// updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1124
|
+
// * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1125
|
+
// Google model to determine the keyword-based overlap between the query and
|
1126
|
+
// the document.
|
1127
|
+
// * `base_rank`: the default rank of the result
|
1064
1128
|
string ranking_expression = 26;
|
1065
1129
|
|
1130
|
+
// The backend to use for the ranking expression evaluation.
|
1131
|
+
enum RankingExpressionBackend {
|
1132
|
+
reserved 1, 2;
|
1133
|
+
|
1134
|
+
// Default option for unspecified/unknown values.
|
1135
|
+
RANKING_EXPRESSION_BACKEND_UNSPECIFIED = 0;
|
1136
|
+
// Ranking by custom embedding model, the default way to evaluate the
|
1137
|
+
// ranking expression.
|
1138
|
+
RANK_BY_EMBEDDING = 3;
|
1139
|
+
// Ranking by custom formula.
|
1140
|
+
RANK_BY_FORMULA = 4;
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
// The backend to use for the ranking expression evaluation.
|
1144
|
+
RankingExpressionBackend ranking_expression_backend = 53
|
1145
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1146
|
+
|
1066
1147
|
// Whether to turn on safe search. This is only supported for
|
1067
1148
|
// website search.
|
1068
1149
|
bool safe_search = 20;
|
@@ -1167,6 +1248,49 @@ message SearchResponse {
|
|
1167
1248
|
|
1168
1249
|
// Google provided available scores.
|
1169
1250
|
map<string, DoubleList> model_scores = 4;
|
1251
|
+
|
1252
|
+
// A set of ranking signals.
|
1253
|
+
message RankSignals {
|
1254
|
+
reserved 5;
|
1255
|
+
|
1256
|
+
// Keyword matching adjustment.
|
1257
|
+
optional float keyword_similarity_score = 1
|
1258
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1259
|
+
// Semantic relevance adjustment.
|
1260
|
+
optional float relevance_score = 2
|
1261
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1262
|
+
// Semantic similarity adjustment.
|
1263
|
+
optional float semantic_similarity_score = 3
|
1264
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1265
|
+
// Predicted conversion rate adjustment as a rank.
|
1266
|
+
optional float pctr_rank = 4 [(google.api.field_behavior) = OPTIONAL];
|
1267
|
+
// Topicality adjustment as a rank.
|
1268
|
+
optional float topicality_rank = 6
|
1269
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1270
|
+
// Age of the document in hours.
|
1271
|
+
optional float document_age = 7 [(google.api.field_behavior) = OPTIONAL];
|
1272
|
+
// Combined custom boosts for a doc.
|
1273
|
+
optional float boosting_factor = 8
|
1274
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1275
|
+
|
1276
|
+
// The default rank of the result.
|
1277
|
+
float default_rank = 32 [(google.api.field_behavior) = OPTIONAL];
|
1278
|
+
|
1279
|
+
// Custom clearbox signal represented by name and value pair.
|
1280
|
+
message CustomSignal {
|
1281
|
+
// Name of the signal.
|
1282
|
+
string name = 1 [(google.api.field_behavior) = OPTIONAL];
|
1283
|
+
// Float value representing the ranking signal (e.g. 1.25 for BM25).
|
1284
|
+
float value = 2 [(google.api.field_behavior) = OPTIONAL];
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
// A list of custom clearbox signals.
|
1288
|
+
repeated CustomSignal custom_signals = 33
|
1289
|
+
[(google.api.field_behavior) = OPTIONAL];
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
// A set of ranking signals associated with the result.
|
1293
|
+
RankSignals rank_signals = 7 [(google.api.field_behavior) = OPTIONAL];
|
1170
1294
|
}
|
1171
1295
|
|
1172
1296
|
// A facet result.
|