@@ -1172,79 +1172,41 @@ public static If ifThenElse(FilterCondition condition, Expr thenExpr, Expr elseE
1172
1172
}
1173
1173
1174
1174
/**
1175
- * Creates an expression that concatenates an array expression with other arrays.
1176
- *
1177
- * <p>Example:
1178
- *
1179
- * <pre>{@code
1180
- * // Combine the 'items' array with two new item arrays
1181
- * Function.arrayConcat(Field.of("items"), Field.of("newItems"), Field.of("otherItems"));
1182
- * }</pre>
1183
- *
1184
- * @param expr The array expression to concatenate to.
1185
- * @param elements The array expressions to concatenate.
1186
- * @return A new {@code Expr} representing the concatenated array.
1187
- */
1188
- @ BetaApi
1189
- public static ArrayConcat arrayConcat (Expr expr , Expr ... elements ) {
1190
- return new ArrayConcat (expr , Arrays .asList (elements ));
1191
- }
1192
-
1193
- /**
1194
- * Creates an expression that concatenates an array expression with other arrays and/or values.
1175
+ * Creates an expression that concatenates an array expression with another array.
1195
1176
*
1196
1177
* <p>Example:
1197
1178
*
1198
1179
* <pre>{@code
1199
1180
* // Combine the 'tags' array with a new array
1200
- * Function.arrayConcat(Field.of("tags"), Arrays.asList ("newTag1", "newTag2"));
1181
+ * Function.arrayConcat(Field.of("tags"), List.newArrayList ("newTag1", "newTag2"));
1201
1182
* }</pre>
1202
1183
*
1203
1184
* @param expr The array expression to concatenate to.
1204
- * @param elements The array expressions or single values to concatenate.
1205
- * @return A new {@code Expr} representing the concatenated array.
1206
- */
1207
- @ BetaApi
1208
- public static ArrayConcat arrayConcat (Expr expr , Object ... elements ) {
1209
- return new ArrayConcat (expr , toExprList (elements ));
1210
- }
1211
-
1212
- /**
1213
- * Creates an expression that concatenates a field's array value with other arrays.
1214
- *
1215
- * <p>Example:
1216
- *
1217
- * <pre>{@code
1218
- * // Combine the 'items' array with two new item arrays
1219
- * Function.arrayConcat("items", Field.of("newItems"), Field.of("otherItems"));
1220
- * }</pre>
1221
- *
1222
- * @param field The field name containing array values.
1223
- * @param elements The array expressions to concatenate.
1185
+ * @param array The array of constants or expressions to concat with.
1224
1186
* @return A new {@code Expr} representing the concatenated array.
1225
1187
*/
1226
1188
@ BetaApi
1227
- public static ArrayConcat arrayConcat (String field , Expr ... elements ) {
1228
- return new ArrayConcat (Field . of ( field ), Arrays . asList ( elements ));
1189
+ public static ArrayConcat arrayConcat (Expr expr , List < Object > array ) {
1190
+ return new ArrayConcat (expr , toExprList ( array . toArray () ));
1229
1191
}
1230
1192
1231
1193
/**
1232
- * Creates an expression that concatenates a field's array value with other arrays and/or values .
1194
+ * Creates an expression that concatenates a field's array value with another array .
1233
1195
*
1234
1196
* <p>Example:
1235
1197
*
1236
1198
* <pre>{@code
1237
1199
* // Combine the 'tags' array with a new array
1238
- * Function.arrayConcat("tags", Arrays.asList ("newTag1", "newTag2"));
1200
+ * Function.arrayConcat("tags", List.newArrayList ("newTag1", "newTag2"));
1239
1201
* }</pre>
1240
1202
*
1241
1203
* @param field The field name containing array values.
1242
- * @param elements The array expressions or single values to concatenate .
1204
+ * @param array The array of constants or expressions to concat with .
1243
1205
* @return A new {@code Expr} representing the concatenated array.
1244
1206
*/
1245
1207
@ BetaApi
1246
- public static ArrayConcat arrayConcat (String field , Object ... elements ) {
1247
- return new ArrayConcat (Field .of (field ), toExprList (elements ));
1208
+ public static ArrayConcat arrayConcat (String field , List < Object > array ) {
1209
+ return new ArrayConcat (Field .of (field ), toExprList (array . toArray () ));
1248
1210
}
1249
1211
1250
1212
/**
@@ -2335,79 +2297,79 @@ public static CosineDistance cosineDistance(String field, double[] other) {
2335
2297
}
2336
2298
2337
2299
/**
2338
- * Calculates the dot product distance between two vector expressions.
2300
+ * Calculates the dot product between two vector expressions.
2339
2301
*
2340
2302
* <p>Example:
2341
2303
*
2342
2304
* <pre>{@code
2343
- * // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2'
2344
- * Function.dotProductDistance (Field.of("docVector1"), Field.of("docVector2"));
2305
+ * // Calculate the dot product between two document vectors: 'docVector1' and 'docVector2'
2306
+ * Function.dotProduct (Field.of("docVector1"), Field.of("docVector2"));
2345
2307
* }</pre>
2346
2308
*
2347
- * @param expr The first vector (represented as an Expr) to compare against .
2348
- * @param other The other vector (represented as an Expr) to compare against .
2349
- * @return A new {@code Expr} representing the dot product distance between the two vectors.
2309
+ * @param expr The first vector (represented as an Expr) to calculate dot product with .
2310
+ * @param other The other vector (represented as an Expr) to calculate dot product with .
2311
+ * @return A new {@code Expr} representing the dot product between the two vectors.
2350
2312
*/
2351
2313
@ BetaApi
2352
- public static DotProductDistance dotProductDistance (Expr expr , Expr other ) {
2353
- return new DotProductDistance (expr , other );
2314
+ public static DotProduct dotProduct (Expr expr , Expr other ) {
2315
+ return new DotProduct (expr , other );
2354
2316
}
2355
2317
2356
2318
/**
2357
- * Calculates the dot product distance between a vector expression and a double array.
2319
+ * Calculates the dot product between a vector expression and a double array.
2358
2320
*
2359
2321
* <p>Example:
2360
2322
*
2361
2323
* <pre>{@code
2362
- * // Calculate the dot product distance between a feature vector and a target vector
2363
- * Function.dotProductDistance (Field.of("features"), new double[] {0.5, 0.8, 0.2});
2324
+ * // Calculate the dot product between a feature vector and a target vector
2325
+ * Function.dotProduct (Field.of("features"), new double[] {0.5, 0.8, 0.2});
2364
2326
* }</pre>
2365
2327
*
2366
- * @param expr The first vector (represented as an Expr) to compare against .
2367
- * @param other The other vector (as an array of doubles ) to compare against .
2368
- * @return A new {@code Expr} representing the dot product distance between the two vectors.
2328
+ * @param expr The first vector (represented as an Expr) to calculate dot product with .
2329
+ * @param other The other vector (represented as an Expr ) to calculate dot product with .
2330
+ * @return A new {@code Expr} representing the dot product between the two vectors.
2369
2331
*/
2370
2332
@ BetaApi
2371
- public static DotProductDistance dotProductDistance (Expr expr , double [] other ) {
2372
- return new DotProductDistance (expr , Constant .vector (other ));
2333
+ public static DotProduct dotProduct (Expr expr , double [] other ) {
2334
+ return new DotProduct (expr , Constant .vector (other ));
2373
2335
}
2374
2336
2375
2337
/**
2376
- * Calculates the dot product distance between a field's vector value and a vector expression.
2338
+ * Calculates the dot product between a field's vector value and a vector expression.
2377
2339
*
2378
2340
* <p>Example:
2379
2341
*
2380
2342
* <pre>{@code
2381
- * // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2'
2382
- * Function.dotProductDistance ("docVector1", Field.of("docVector2"));
2343
+ * // Calculate the dot product between two document vectors: 'docVector1' and 'docVector2'
2344
+ * Function.dotProduct ("docVector1", Field.of("docVector2"));
2383
2345
* }</pre>
2384
2346
*
2385
2347
* @param field The name of the field containing the first vector.
2386
- * @param other The other vector (represented as an Expr) to compare against .
2348
+ * @param other The other vector (represented as an Expr) to calculate dot product with .
2387
2349
* @return A new {@code Expr} representing the dot product distance between the two vectors.
2388
2350
*/
2389
2351
@ BetaApi
2390
- public static DotProductDistance dotProductDistance (String field , Expr other ) {
2391
- return new DotProductDistance (Field .of (field ), other );
2352
+ public static DotProduct dotProduct (String field , Expr other ) {
2353
+ return new DotProduct (Field .of (field ), other );
2392
2354
}
2393
2355
2394
2356
/**
2395
- * Calculates the dot product distance between a field's vector value and a double array.
2357
+ * Calculates the dot product between a field's vector value and a double array.
2396
2358
*
2397
2359
* <p>Example:
2398
2360
*
2399
2361
* <pre>{@code
2400
- * // Calculate the dot product distance between a feature vector and a target vector
2401
- * Function.dotProductDistance ("features", new double[] {0.5, 0.8, 0.2});
2362
+ * // Calculate the dot product between a feature vector and a target vector
2363
+ * Function.dotProduct ("features", new double[] {0.5, 0.8, 0.2});
2402
2364
* }</pre>
2403
2365
*
2404
2366
* @param field The name of the field containing the first vector.
2405
- * @param other The other vector (as an array of doubles ) to compare against .
2367
+ * @param other The other vector (represented as an Expr ) to calculate dot product with .
2406
2368
* @return A new {@code Expr} representing the dot product distance between the two vectors.
2407
2369
*/
2408
2370
@ BetaApi
2409
- public static DotProductDistance dotProductDistance (String field , double [] other ) {
2410
- return new DotProductDistance (Field .of (field ), Constant .vector (other ));
2371
+ public static DotProduct dotProduct (String field , double [] other ) {
2372
+ return new DotProduct (Field .of (field ), Constant .vector (other ));
2411
2373
}
2412
2374
2413
2375
/**
0 commit comments