@@ -424,6 +424,10 @@ enum RecommendStrategy {
424424 // examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`.
425425 // If the `max_neg_score` is chosen then it is squared and negated.
426426 BestScore = 1 ;
427+
428+ // Uses custom search objective. Compares against all inputs, sums all the scores.
429+ // Scores against positive vectors are added, against negatives are subtracted.
430+ SumScores = 2 ;
427431}
428432
429433message LookupLocation {
@@ -571,6 +575,70 @@ enum Sample {
571575 Random = 0 ;
572576}
573577
578+ message Formula {
579+ Expression expression = 1 ;
580+ map <string , Value > defaults = 2 ;
581+ }
582+
583+ message Expression {
584+ oneof variant {
585+ float constant = 1 ;
586+ string variable = 2 ; // Payload key or reference to score.
587+ Condition condition = 3 ; // Payload condition. If true, becomes 1.0; otherwise 0.0
588+ GeoDistance geo_distance = 4 ; // Geographic distance in meters
589+ string datetime = 5 ; // Date-time constant
590+ string datetime_key = 6 ; // Payload key with date-time values
591+ MultExpression mult = 7 ; // Multiply
592+ SumExpression sum = 8 ; // Sum
593+ DivExpression div = 9 ; // Divide
594+ Expression neg = 10 ; // Negate
595+ Expression abs = 11 ; // Absolute value
596+ Expression sqrt = 12 ; // Square root
597+ PowExpression pow = 13 ; // Power
598+ Expression exp = 14 ; // Exponential
599+ Expression log10 = 15 ; // Logarithm
600+ Expression ln = 16 ; // Natural logarithm
601+ DecayParamsExpression exp_decay = 17 ; // Exponential decay
602+ DecayParamsExpression gauss_decay = 18 ; // Gaussian decay
603+ DecayParamsExpression lin_decay = 19 ; // Linear decay
604+ }
605+ }
606+
607+ message GeoDistance {
608+ GeoPoint origin = 1 ;
609+ string to = 2 ;
610+ }
611+
612+ message MultExpression {
613+ repeated Expression mult = 1 ;
614+ }
615+
616+ message SumExpression {
617+ repeated Expression sum = 1 ;
618+ }
619+
620+ message DivExpression {
621+ Expression left = 1 ;
622+ Expression right = 2 ;
623+ optional float by_zero_default = 3 ;
624+ }
625+
626+ message PowExpression {
627+ Expression base = 1 ;
628+ Expression exponent = 2 ;
629+ }
630+
631+ message DecayParamsExpression {
632+ // The variable to decay
633+ Expression x = 1 ;
634+ // The target value to start decaying from. Defaults to 0.
635+ optional Expression target = 2 ;
636+ // The scale factor of the decay, in terms of `x`. Defaults to 1.0. Must be a non-zero positive number.
637+ optional float scale = 3 ;
638+ // The midpoint of the decay. Defaults to 0.5. Output will be this value when `|x - target| == scale`.
639+ optional float midpoint = 4 ;
640+ }
641+
574642message Query {
575643 oneof variant {
576644 VectorInput nearest = 1 ; // Find the nearest neighbors to this vector.
@@ -580,6 +648,7 @@ message Query {
580648 OrderBy order_by = 5 ; // Order the points by a payload field.
581649 Fusion fusion = 6 ; // Fuse the results of multiple prefetches.
582650 Sample sample = 7 ; // Sample points from the collection.
651+ Formula formula = 8 ; // Score boosting via an arbitrary formula
583652 }
584653}
585654
@@ -760,6 +829,7 @@ message UpdateBatchPoints {
760829message PointsOperationResponse {
761830 UpdateResult result = 1 ;
762831 double time = 2 ; // Time spent to process
832+ optional HardwareUsage usage = 3 ;
763833}
764834
765835message UpdateResult {
@@ -863,6 +933,7 @@ message ScrollResponse {
863933 optional PointId next_page_offset = 1 ; // Use this offset for the next query
864934 repeated RetrievedPoint result = 2 ;
865935 double time = 3 ; // Time spent to process
936+ optional HardwareUsage usage = 4 ;
866937}
867938
868939message CountResult {
@@ -881,6 +952,7 @@ message RetrievedPoint {
881952message GetResponse {
882953 repeated RetrievedPoint result = 1 ;
883954 double time = 2 ; // Time spent to process
955+ optional HardwareUsage usage = 3 ;
884956}
885957
886958message RecommendResponse {
@@ -993,6 +1065,8 @@ message FieldCondition {
9931065 ValuesCount values_count = 6 ; // Check number of values for a specific field
9941066 GeoPolygon geo_polygon = 7 ; // Check if geo point is within a given polygon
9951067 DatetimeRange datetime_range = 8 ; // Check if datetime is within a given range
1068+ optional bool is_empty = 9 ; // Check if field is empty
1069+ optional bool is_null = 10 ; // Check if field is null
9961070}
9971071
9981072message Match {
@@ -1097,6 +1171,10 @@ message GeoPoint {
10971171
10981172message HardwareUsage {
10991173 uint64 cpu = 1 ;
1100- uint64 io_read = 2 ;
1101- uint64 io_write = 3 ;
1174+ uint64 payload_io_read = 2 ;
1175+ uint64 payload_io_write = 3 ;
1176+ uint64 payload_index_io_read = 4 ;
1177+ uint64 payload_index_io_write = 5 ;
1178+ uint64 vector_io_read = 6 ;
1179+ uint64 vector_io_write = 7 ;
11021180}
0 commit comments