Skip to content

Commit 637cee6

Browse files
agourlayclaude
andauthored
Sync client with latest dev protobuf (#301)
TextQuery's `k` and `b` move into a per-scorer `Bm25Params` (qdrant#11012). TextQueryBuilder keeps its `k`/`b` setters and now fills `scoring.bm25`, so callers need no change. Also picks up `Datatype::Turbo16`. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 71143d8 commit 637cee6

4 files changed

Lines changed: 57 additions & 15 deletions

File tree

‎proto/collections.proto‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum Datatype {
1414
Float16 = 3;
1515
Turbo4 = 4;
1616
Turbo8 = 5;
17+
Turbo16 = 6;
1718
}
1819

1920
// Memory placement of a component's data.

‎proto/points.proto‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ message DenseVectorCreationConfig {
362362
Distance distance = 2;
363363
// Configuration for multi-vector search (e.g., ColBERT)
364364
optional MultiVectorConfig multivector_config = 3;
365-
// Data type of the vectors (Float32, Float16, Uint8, Turbo4, Turbo8)
365+
// Data type of the vectors (Float32, Float16, Uint8, Turbo4, Turbo8, Turbo16)
366366
optional Datatype datatype = 4;
367367
}
368368

@@ -500,8 +500,8 @@ message AcornSearchParams {
500500
optional double max_selectivity = 2;
501501
}
502502

503-
// Population over which sparse vector IDF statistics are computed for scoring - the IDF corpus.
504-
// Only applicable to sparse vectors with the IDF modifier enabled.
503+
// Population over which IDF statistics are computed for scoring - the IDF corpus.
504+
// Only applicable to sparse vectors with the IDF modifier enabled, and to BM25 over a text index.
505505
message IdfParams {
506506
// Filter defining the corpus: IDF statistics are computed over the points matching this filter.
507507
// If unset, statistics are collection-wide (global) - same as omitting `idf` entirely.
@@ -526,7 +526,7 @@ message SearchParams {
526526
// ACORN search params
527527
optional AcornSearchParams acorn = 5;
528528

529-
// Which population sparse vector IDF statistics are computed over.
529+
// Which population IDF statistics are computed over.
530530
// If unset, statistics are collection-wide (global).
531531
optional IdfParams idf = 6;
532532
}
@@ -1103,12 +1103,23 @@ message Query {
11031103
// which must have `scoring` set. A point scores when it holds any of the
11041104
// query's terms: required or excluded terms belong in the request's filter.
11051105
message TextQuery {
1106+
reserved 2, 3;
11061107
// Text to search for, tokenized by the field's text index.
11071108
string query = 1;
1109+
// Parameters of the scorer, keyed by its name. They must match the
1110+
// `scoring` type of the field's text index. If absent, the scorer runs
1111+
// with its defaults.
1112+
oneof scoring {
1113+
// BM25 parameters, for a field scored with BM25.
1114+
Bm25Params bm25 = 4;
1115+
}
1116+
}
1117+
1118+
message Bm25Params {
11081119
// Term frequency saturation. Default is 1.2.
1109-
optional float k = 2;
1120+
optional float k = 1;
11101121
// Document length normalization, from 0 (none) to 1 (full). Default is 0.75.
1111-
optional float b = 3;
1122+
optional float b = 2;
11121123
}
11131124

11141125
message PrefetchQuery {

‎src/builders/text_query_builder.rs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::qdrant::TextQuery;
1+
use crate::qdrant::{text_query, Bm25Params, TextQuery};
22

33
/// Builder for [`TextQuery`], ranking points by BM25 over the text index of a payload field.
44
///
@@ -47,11 +47,18 @@ impl TextQueryBuilder {
4747
new
4848
}
4949

50+
/// Builds the query. `k` and `b` go in the BM25 scorer's parameters; with neither set, the
51+
/// scorer runs with its defaults.
5052
pub fn build(self) -> TextQuery {
53+
let scoring = (self.k.is_some() || self.b.is_some()).then_some(text_query::Scoring::Bm25(
54+
Bm25Params {
55+
k: self.k,
56+
b: self.b,
57+
},
58+
));
5159
TextQuery {
5260
query: self.query,
53-
k: self.k,
54-
b: self.b,
61+
scoring,
5562
}
5663
}
5764
}

‎src/qdrant.rs‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,7 @@ pub enum Datatype {
19501950
Float16 = 3,
19511951
Turbo4 = 4,
19521952
Turbo8 = 5,
1953+
Turbo16 = 6,
19531954
}
19541955
impl Datatype {
19551956
/// String value of the enum field names used in the ProtoBuf definition.
@@ -1964,6 +1965,7 @@ impl Datatype {
19641965
Self::Float16 => "Float16",
19651966
Self::Turbo4 => "Turbo4",
19661967
Self::Turbo8 => "Turbo8",
1968+
Self::Turbo16 => "Turbo16",
19671969
}
19681970
}
19691971
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -1975,6 +1977,7 @@ impl Datatype {
19751977
"Float16" => Some(Self::Float16),
19761978
"Turbo4" => Some(Self::Turbo4),
19771979
"Turbo8" => Some(Self::Turbo8),
1980+
"Turbo16" => Some(Self::Turbo16),
19781981
_ => None,
19791982
}
19801983
}
@@ -4316,7 +4319,7 @@ pub struct DenseVectorCreationConfig {
43164319
/// Configuration for multi-vector search (e.g., ColBERT)
43174320
#[prost(message, optional, tag = "3")]
43184321
pub multivector_config: ::core::option::Option<MultiVectorConfig>,
4319-
/// Data type of the vectors (Float32, Float16, Uint8, Turbo4, Turbo8)
4322+
/// Data type of the vectors (Float32, Float16, Uint8, Turbo4, Turbo8, Turbo16)
43204323
#[prost(enumeration = "Datatype", optional, tag = "4")]
43214324
pub datatype: ::core::option::Option<i32>,
43224325
}
@@ -4518,8 +4521,8 @@ pub struct AcornSearchParams {
45184521
#[prost(double, optional, tag = "2")]
45194522
pub max_selectivity: ::core::option::Option<f64>,
45204523
}
4521-
/// Population over which sparse vector IDF statistics are computed for scoring - the IDF corpus.
4522-
/// Only applicable to sparse vectors with the IDF modifier enabled.
4524+
/// Population over which IDF statistics are computed for scoring - the IDF corpus.
4525+
/// Only applicable to sparse vectors with the IDF modifier enabled, and to BM25 over a text index.
45234526
#[derive(Clone, PartialEq, ::prost::Message)]
45244527
pub struct IdfParams {
45254528
/// Filter defining the corpus: IDF statistics are computed over the points matching this filter.
@@ -4547,7 +4550,7 @@ pub struct SearchParams {
45474550
/// ACORN search params
45484551
#[prost(message, optional, tag = "5")]
45494552
pub acorn: ::core::option::Option<AcornSearchParams>,
4550-
/// Which population sparse vector IDF statistics are computed over.
4553+
/// Which population IDF statistics are computed over.
45514554
/// If unset, statistics are collection-wide (global).
45524555
#[prost(message, optional, tag = "6")]
45534556
pub idf: ::core::option::Option<IdfParams>,
@@ -5323,11 +5326,31 @@ pub struct TextQuery {
53235326
/// Text to search for, tokenized by the field's text index.
53245327
#[prost(string, tag = "1")]
53255328
pub query: ::prost::alloc::string::String,
5329+
/// Parameters of the scorer, keyed by its name. They must match the
5330+
/// `scoring` type of the field's text index. If absent, the scorer runs
5331+
/// with its defaults.
5332+
#[prost(oneof = "text_query::Scoring", tags = "4")]
5333+
pub scoring: ::core::option::Option<text_query::Scoring>,
5334+
}
5335+
/// Nested message and enum types in `TextQuery`.
5336+
pub mod text_query {
5337+
/// Parameters of the scorer, keyed by its name. They must match the
5338+
/// `scoring` type of the field's text index. If absent, the scorer runs
5339+
/// with its defaults.
5340+
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
5341+
pub enum Scoring {
5342+
/// BM25 parameters, for a field scored with BM25.
5343+
#[prost(message, tag = "4")]
5344+
Bm25(super::Bm25Params),
5345+
}
5346+
}
5347+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5348+
pub struct Bm25Params {
53265349
/// Term frequency saturation. Default is 1.2.
5327-
#[prost(float, optional, tag = "2")]
5350+
#[prost(float, optional, tag = "1")]
53285351
pub k: ::core::option::Option<f32>,
53295352
/// Document length normalization, from 0 (none) to 1 (full). Default is 0.75.
5330-
#[prost(float, optional, tag = "3")]
5353+
#[prost(float, optional, tag = "2")]
53315354
pub b: ::core::option::Option<f32>,
53325355
}
53335356
#[derive(Clone, PartialEq, ::prost::Message)]

0 commit comments

Comments
 (0)