Skip to content

Commit 6c618ed

Browse files
authored
Merge pull request #28 from qdrant/update-1.1.1
Update 1.1.1
2 parents e36af14 + 356efc6 commit 6c618ed

File tree

10 files changed

+566
-879
lines changed

10 files changed

+566
-879
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "qdrant-client"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2021"
55
authors = ["Qdrant Team <team@qdrant.com>"]
66
description = "Rust client for Qdrant Vector Search Engine"
@@ -17,14 +17,14 @@ tonic = { version = "0.8.3", features = ["tls", "tls-roots"] }
1717
prost = "0.11.8"
1818
prost-types = "0.11.8"
1919
anyhow = "1"
20-
reqwest = { version = "0.11.14", optional = true, features = ["stream"] }
21-
futures-util = { version = "0.3.27", optional = true }
20+
reqwest = { version = "0.11.16", optional = true, features = ["stream"] }
21+
futures-util = { version = "0.3.28", optional = true }
2222

2323
[build-dependencies]
2424
tonic-build = { version = "0.8.4", features = ["prost"] }
2525

2626
[dev-dependencies]
27-
tokio = { version = "1.26.0", features = ["rt-multi-thread"] }
27+
tokio = { version = "1.27.0", features = ["rt-multi-thread"] }
2828

2929
[features]
3030
default = ["download_snapshots"]

examples/search.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ async fn main() -> Result<()> {
3232
config: Some(Config::Params(VectorParams {
3333
size: 10,
3434
distance: Distance::Cosine.into(),
35+
hnsw_config: None,
36+
quantization_config: None,
3537
})),
3638
}),
3739
..Default::default()

proto/collections.proto

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ package qdrant;
44
message VectorParams {
55
uint64 size = 1; // Size of the vectors
66
Distance distance = 2; // Distance function used for comparing vectors
7+
optional HnswConfigDiff hnsw_config = 3; // Configuration of vector HNSW graph. If omitted - the collection configuration will be used
8+
optional QuantizationConfig quantization_config = 4; // Configuration of vector quantization config. If omitted - the collection configuration will be used
79
}
810

911
message VectorParamsMap {
@@ -77,22 +79,22 @@ message HnswConfigDiff {
7779
*/
7880
optional uint64 m = 1;
7981
/*
80-
Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build index.
82+
Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build the index.
8183
*/
8284
optional uint64 ef_construct = 2;
8385
/*
8486
Minimal size (in KiloBytes) of vectors for additional payload-based indexing.
85-
If payload chunk is smaller than `full_scan_threshold` additional indexing won't be used -
87+
If the payload chunk is smaller than `full_scan_threshold` additional indexing won't be used -
8688
in this case full-scan search should be preferred by query planner and additional indexing is not required.
87-
Note: 1Kb = 1 vector of size 256
89+
Note: 1 Kb = 1 vector of size 256
8890
*/
8991
optional uint64 full_scan_threshold = 3;
9092
/*
9193
Number of parallel threads used for background index building. If 0 - auto selection.
9294
*/
9395
optional uint64 max_indexing_threads = 4;
9496
/*
95-
Store HNSW index on disk. If set to false, index will be stored in RAM.
97+
Store HNSW index on disk. If set to false, the index will be stored in RAM.
9698
*/
9799
optional bool on_disk = 5;
98100
/*
@@ -116,13 +118,13 @@ message OptimizersConfigDiff {
116118
*/
117119
optional uint64 vacuum_min_vector_number = 2;
118120
/*
119-
Target amount of segments optimizer will try to keep.
121+
Target amount of segments the optimizer will try to keep.
120122
Real amount of segments may vary depending on multiple parameters:
121123
122124
- Amount of stored points.
123125
- Current write RPS.
124126
125-
It is recommended to select default number of segments as a factor of the number of search threads,
127+
It is recommended to select the default number of segments as a factor of the number of search threads,
126128
so that each segment would be handled evenly by one of the threads.
127129
*/
128130
optional uint64 default_segment_number = 3;
@@ -131,14 +133,14 @@ message OptimizersConfigDiff {
131133
Large segments might require disproportionately long indexation times,
132134
therefore it makes sense to limit the size of segments.
133135
134-
If indexation speed have more priority for your - make this parameter lower.
136+
If indexation speed has more priority for you - make this parameter lower.
135137
If search speed is more important - make this parameter higher.
136138
Note: 1Kb = 1 vector of size 256
137139
*/
138140
optional uint64 max_segment_size = 4;
139141
/*
140142
Maximum size (in KiloBytes) of vectors to store in-memory per segment.
141-
Segments larger than this threshold will be stored as read-only memmaped file.
143+
Segments larger than this threshold will be stored as a read-only memmaped file.
142144
To enable memmap storage, lower the threshold
143145
Note: 1Kb = 1 vector of size 256
144146
*/
@@ -185,7 +187,7 @@ message CreateCollection {
185187
optional uint32 replication_factor = 11; // Number of replicas of each shard that network tries to maintain, default = 1
186188
optional uint32 write_consistency_factor = 12; // How many replicas should apply the operation for us to consider it successful, default = 1
187189
optional string init_from_collection = 13; // Specify name of the other collection to copy data from
188-
optional QuantizationConfig quantization_config = 14;
190+
optional QuantizationConfig quantization_config = 14; // Quantization configuration of vector
189191
}
190192

191193
message UpdateCollection {
@@ -237,7 +239,7 @@ enum TokenizerType {
237239

238240
message TextIndexParams {
239241
TokenizerType tokenizer = 1; // Tokenizer type
240-
optional bool lowercase = 2; // If true - all tokens will be lowercased
242+
optional bool lowercase = 2; // If true - all tokens will be lowercase
241243
optional uint64 min_token_len = 3; // Minimal token length
242244
optional uint64 max_token_len = 4; // Maximal token length
243245
}
@@ -309,4 +311,4 @@ message AliasDescription {
309311
message ListAliasesResponse {
310312
repeated AliasDescription aliases = 1;
311313
double time = 2; // Time spent to process
312-
}
314+
}

proto/json_with_int.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ package qdrant;
1111
// object. The details of that representation are described together
1212
// with the proto support for the language.
1313
//
14-
// The JSON representation for `Struct` is JSON object.
14+
// The JSON representation for `Struct` is a JSON object.
1515
message Struct {
1616
// Unordered map of dynamically typed values.
1717
map<string, Value> fields = 1;
1818
}
1919

2020
// `Value` represents a dynamically typed value which can be either
2121
// null, a number, a string, a boolean, a recursive struct value, or a
22-
// list of values. A producer of value is expected to set one of that
22+
// list of values. A producer of value is expected to set one of those
2323
// variants, absence of any variant indicates an error.
2424
//
25-
// The JSON representation for `Value` is JSON value.
25+
// The JSON representation for `Value` is a JSON value.
2626
message Value {
2727
// The kind of value.
2828
oneof kind {
@@ -54,7 +54,7 @@ enum NullValue {
5454

5555
// `ListValue` is a wrapper around a repeated field of values.
5656
//
57-
// The JSON representation for `ListValue` is JSON array.
57+
// The JSON representation for `ListValue` is a JSON array.
5858
message ListValue {
5959
// Repeated field of dynamically typed values.
6060
repeated Value values = 1;

proto/points.proto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,18 @@ message Condition {
350350
IsEmptyCondition is_empty = 2;
351351
HasIdCondition has_id = 3;
352352
Filter filter = 4;
353+
IsNullCondition is_null = 5;
353354
}
354355
}
355356

356357
message IsEmptyCondition {
357358
string key = 1;
358359
}
359360

361+
message IsNullCondition {
362+
string key = 1;
363+
}
364+
360365
message HasIdCondition {
361366
repeated PointId has_id = 1;
362367
}
@@ -365,7 +370,7 @@ message FieldCondition {
365370
string key = 1;
366371
Match match = 2; // Check if point has field with a given value
367372
Range range = 3; // Check if points value lies in a given range
368-
GeoBoundingBox geo_bounding_box = 4; // Check if points geo location lies in a given area
373+
GeoBoundingBox geo_bounding_box = 4; // Check if points geolocation lies in a given area
369374
GeoRadius geo_radius = 5; // Check if geo point is within a given radius
370375
ValuesCount values_count = 6; // Check number of values for a specific field
371376
}

proto/points_service.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "google/protobuf/struct.proto";
88

99
service Points {
1010
/*
11-
Perform insert + updates on points. If point with given ID already exists - it will be overwritten.
11+
Perform insert + updates on points. If a point with a given ID already exists - it will be overwritten.
1212
*/
1313
rpc Upsert (UpsertPoints) returns (PointsOperationResponse) {}
1414
/*
@@ -67,4 +67,4 @@ service Points {
6767
Count points in collection with given filtering conditions
6868
*/
6969
rpc Count (CountPoints) returns (CountResponse) {}
70-
}
70+
}

src/client.rs

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,24 @@ use crate::qdrant::snapshots_client::SnapshotsClient;
99
use crate::qdrant::value::Kind;
1010
use crate::qdrant::vectors::VectorsOptions;
1111
use crate::qdrant::with_payload_selector::SelectorOptions;
12-
use crate::qdrant::{qdrant_client, with_vectors_selector, AliasOperations, ChangeAliases, ClearPayloadPoints, CollectionOperationResponse, Condition, CountPoints, CountResponse, CreateAlias, CreateCollection, CreateFieldIndexCollection, CreateFullSnapshotRequest, CreateSnapshotRequest, CreateSnapshotResponse, DeleteAlias, DeleteCollection, DeleteFieldIndexCollection, DeleteFullSnapshotRequest, DeletePayloadPoints, DeletePoints, DeleteSnapshotRequest, DeleteSnapshotResponse, FieldCondition, FieldType, Filter, GetCollectionInfoRequest, GetCollectionInfoResponse, GetPoints, GetResponse, HasIdCondition, HealthCheckReply, HealthCheckRequest, IsEmptyCondition, ListAliasesRequest, ListAliasesResponse, ListCollectionAliasesRequest, ListCollectionsRequest, ListCollectionsResponse, ListFullSnapshotsRequest, ListSnapshotsRequest, ListSnapshotsResponse, ListValue, NamedVectors, OptimizersConfigDiff, PayloadIncludeSelector, PayloadIndexParams, PointId, PointStruct, PointsIdsList, PointsOperationResponse, PointsSelector, RecommendBatchPoints, RecommendBatchResponse, RecommendPoints, RecommendResponse, RenameAlias, ScrollPoints, ScrollResponse, SearchBatchPoints, SearchBatchResponse, SearchPoints, SearchResponse, SetPayloadPoints, Struct, UpdateCollection, UpsertPoints, Value, Vector, Vectors, VectorsSelector, WithPayloadSelector, WithVectorsSelector, WriteOrdering, ReadConsistency};
12+
use crate::qdrant::{
13+
qdrant_client, with_vectors_selector, AliasOperations, ChangeAliases, ClearPayloadPoints,
14+
CollectionOperationResponse, Condition, CountPoints, CountResponse, CreateAlias,
15+
CreateCollection, CreateFieldIndexCollection, CreateFullSnapshotRequest, CreateSnapshotRequest,
16+
CreateSnapshotResponse, DeleteAlias, DeleteCollection, DeleteFieldIndexCollection,
17+
DeleteFullSnapshotRequest, DeletePayloadPoints, DeletePoints, DeleteSnapshotRequest,
18+
DeleteSnapshotResponse, FieldCondition, FieldType, Filter, GetCollectionInfoRequest,
19+
GetCollectionInfoResponse, GetPoints, GetResponse, HasIdCondition, HealthCheckReply,
20+
HealthCheckRequest, IsEmptyCondition, ListAliasesRequest, ListAliasesResponse,
21+
ListCollectionAliasesRequest, ListCollectionsRequest, ListCollectionsResponse,
22+
ListFullSnapshotsRequest, ListSnapshotsRequest, ListSnapshotsResponse, ListValue, NamedVectors,
23+
OptimizersConfigDiff, PayloadIncludeSelector, PayloadIndexParams, PointId, PointStruct,
24+
PointsIdsList, PointsOperationResponse, PointsSelector, ReadConsistency, RecommendBatchPoints,
25+
RecommendBatchResponse, RecommendPoints, RecommendResponse, RenameAlias, ScrollPoints,
26+
ScrollResponse, SearchBatchPoints, SearchBatchResponse, SearchPoints, SearchResponse,
27+
SetPayloadPoints, Struct, UpdateCollection, UpsertPoints, Value, Vector, Vectors,
28+
VectorsSelector, WithPayloadSelector, WithVectorsSelector, WriteOrdering,
29+
};
1330
use anyhow::{bail, Result};
1431
use std::collections::HashMap;
1532
use std::future::Future;
@@ -30,7 +47,10 @@ pub struct QdrantClientConfig {
3047

3148
impl QdrantClientConfig {
3249
pub fn from_url(url: &str) -> Self {
33-
QdrantClientConfig { uri: url.to_string(), ..Self::default() }
50+
QdrantClientConfig {
51+
uri: url.to_string(),
52+
..Self::default()
53+
}
3454
}
3555

3656
pub fn set_api_key(&mut self, api_key: &str) {
@@ -499,7 +519,8 @@ impl QdrantClient {
499519
points: Vec<PointStruct>,
500520
ordering: Option<WriteOrdering>,
501521
) -> Result<PointsOperationResponse> {
502-
self._upsert_points(collection_name, &points, false, ordering).await
522+
self._upsert_points(collection_name, &points, false, ordering)
523+
.await
503524
}
504525

505526
pub async fn upsert_points_blocking(
@@ -508,7 +529,8 @@ impl QdrantClient {
508529
points: Vec<PointStruct>,
509530
ordering: Option<WriteOrdering>,
510531
) -> Result<PointsOperationResponse> {
511-
self._upsert_points(collection_name, &points, true, ordering).await
532+
self._upsert_points(collection_name, &points, true, ordering)
533+
.await
512534
}
513535

514536
#[inline]
@@ -517,7 +539,7 @@ impl QdrantClient {
517539
collection_name: impl ToString,
518540
points: &Vec<PointStruct>,
519541
block: bool,
520-
ordering: Option<WriteOrdering>
542+
ordering: Option<WriteOrdering>,
521543
) -> Result<PointsOperationResponse> {
522544
let collection_name = collection_name.to_string();
523545
let collection_name_ref = collection_name.as_str();
@@ -554,7 +576,7 @@ impl QdrantClient {
554576
collection_name: impl ToString,
555577
points: &PointsSelector,
556578
payload: Payload,
557-
ordering: Option<WriteOrdering>
579+
ordering: Option<WriteOrdering>,
558580
) -> Result<PointsOperationResponse> {
559581
self._set_payload(collection_name, points, &payload, true, ordering)
560582
.await
@@ -594,7 +616,7 @@ impl QdrantClient {
594616
collection_name: impl ToString,
595617
points: &PointsSelector,
596618
payload: Payload,
597-
ordering: Option<WriteOrdering>
619+
ordering: Option<WriteOrdering>,
598620
) -> Result<PointsOperationResponse> {
599621
self._overwrite_payload(collection_name, points, &payload, false, ordering)
600622
.await
@@ -618,7 +640,7 @@ impl QdrantClient {
618640
points: &PointsSelector,
619641
payload: &Payload,
620642
block: bool,
621-
ordering: Option<WriteOrdering>
643+
ordering: Option<WriteOrdering>,
622644
) -> Result<PointsOperationResponse> {
623645
let collection_name = collection_name.to_string();
624646
let collection_name_ref = collection_name.as_str();
@@ -800,7 +822,8 @@ impl QdrantClient {
800822
points: &PointsSelector,
801823
ordering: Option<WriteOrdering>,
802824
) -> Result<PointsOperationResponse> {
803-
self._delete_points(collection_name, false, points, ordering).await
825+
self._delete_points(collection_name, false, points, ordering)
826+
.await
804827
}
805828

806829
pub async fn delete_points_blocking(
@@ -809,7 +832,8 @@ impl QdrantClient {
809832
points: &PointsSelector,
810833
ordering: Option<WriteOrdering>,
811834
) -> Result<PointsOperationResponse> {
812-
self._delete_points(collection_name, true, points, ordering).await
835+
self._delete_points(collection_name, true, points, ordering)
836+
.await
813837
}
814838

815839
async fn _delete_points(

src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ mod tests {
3333
config: Some(Config::Params(VectorParams {
3434
size: 10,
3535
distance: Distance::Cosine.into(),
36+
hnsw_config: None,
37+
quantization_config: None,
3638
})),
3739
}),
3840
..Default::default()
@@ -92,13 +94,19 @@ mod tests {
9294
collection_name,
9395
&vec![0.into()].into(),
9496
vec!["sub_payload".to_string()],
95-
None
97+
None,
9698
)
9799
.await?;
98100

99101
// retrieve points
100102
let points = client
101-
.get_points(collection_name, &vec![0.into()], Some(true), Some(true), None)
103+
.get_points(
104+
collection_name,
105+
&vec![0.into()],
106+
Some(true),
107+
Some(true),
108+
None,
109+
)
102110
.await?;
103111

104112
assert_eq!(points.result.len(), 1);

0 commit comments

Comments
 (0)