Skip to content

Commit

Permalink
Add update_collection_extended
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee authored and generall committed Dec 6, 2023
1 parent 9462cc9 commit c70dee1
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,7 @@ use crate::qdrant::update_collection_cluster_setup_request::Operation;
use crate::qdrant::value::Kind;
use crate::qdrant::vectors::VectorsOptions;
use crate::qdrant::with_payload_selector::SelectorOptions;
use crate::qdrant::{
qdrant_client, with_vectors_selector, AliasOperations, ChangeAliases, ClearPayloadPoints,
CollectionClusterInfoRequest, CollectionClusterInfoResponse, CollectionOperationResponse,
CountPoints, CountResponse, CreateAlias, CreateCollection, CreateFieldIndexCollection,
CreateFullSnapshotRequest, CreateSnapshotRequest, CreateSnapshotResponse, DeleteAlias,
DeleteCollection, DeleteFieldIndexCollection, DeleteFullSnapshotRequest, DeletePayloadPoints,
DeletePointVectors, DeletePoints, DeleteSnapshotRequest, DeleteSnapshotResponse, FieldType,
GetCollectionInfoRequest, GetCollectionInfoResponse, GetPoints, GetResponse, HealthCheckReply,
HealthCheckRequest, ListAliasesRequest, ListAliasesResponse, ListCollectionAliasesRequest,
ListCollectionsRequest, ListCollectionsResponse, ListFullSnapshotsRequest,
ListSnapshotsRequest, ListSnapshotsResponse, ListValue, NamedVectors, OptimizersConfigDiff,
PayloadIncludeSelector, PayloadIndexParams, PointId, PointStruct, PointVectors, PointsIdsList,
PointsOperationResponse, PointsSelector, PointsUpdateOperation, ReadConsistency,
RecommendBatchPoints, RecommendBatchResponse, RecommendGroupsResponse, RecommendPointGroups,
RecommendPoints, RecommendResponse, RenameAlias, ScrollPoints, ScrollResponse,
SearchBatchPoints, SearchBatchResponse, SearchGroupsResponse, SearchPointGroups, SearchPoints,
SearchResponse, SetPayloadPoints, SparseIndices, Struct, UpdateBatchPoints,
UpdateBatchResponse, UpdateCollection, UpdateCollectionClusterSetupRequest,
UpdateCollectionClusterSetupResponse, UpdatePointVectors, UpsertPoints, Value, Vector, Vectors,
VectorsSelector, WithPayloadSelector, WithVectorsSelector, WriteOrdering,
};
use crate::qdrant::{qdrant_client, with_vectors_selector, AliasOperations, ChangeAliases, ClearPayloadPoints, CollectionClusterInfoRequest, CollectionClusterInfoResponse, CollectionOperationResponse, CollectionParamsDiff, CountPoints, CountResponse, CreateAlias, CreateCollection, CreateFieldIndexCollection, CreateFullSnapshotRequest, CreateSnapshotRequest, CreateSnapshotResponse, DeleteAlias, DeleteCollection, DeleteFieldIndexCollection, DeleteFullSnapshotRequest, DeletePayloadPoints, DeletePointVectors, DeletePoints, DeleteSnapshotRequest, DeleteSnapshotResponse, FieldType, GetCollectionInfoRequest, GetCollectionInfoResponse, GetPoints, GetResponse, HealthCheckReply, HealthCheckRequest, HnswConfigDiff, ListAliasesRequest, ListAliasesResponse, ListCollectionAliasesRequest, ListCollectionsRequest, ListCollectionsResponse, ListFullSnapshotsRequest, ListSnapshotsRequest, ListSnapshotsResponse, ListValue, NamedVectors, OptimizersConfigDiff, PayloadIncludeSelector, PayloadIndexParams, PointId, PointStruct, PointVectors, PointsIdsList, PointsOperationResponse, PointsSelector, PointsUpdateOperation, ReadConsistency, RecommendBatchPoints, RecommendBatchResponse, RecommendGroupsResponse, RecommendPointGroups, RecommendPoints, RecommendResponse, RenameAlias, ScrollPoints, ScrollResponse, SearchBatchPoints, SearchBatchResponse, SearchGroupsResponse, SearchPointGroups, SearchPoints, SearchResponse, SetPayloadPoints, SparseIndices, Struct, UpdateBatchPoints, UpdateBatchResponse, UpdateCollection, UpdateCollectionClusterSetupRequest, UpdateCollectionClusterSetupResponse, UpdatePointVectors, UpsertPoints, Value, Vector, Vectors, VectorsSelector, WithPayloadSelector, WithVectorsSelector, WriteOrdering, VectorsConfigDiff, QuantizationConfigDiff, SparseVectorConfig};
use anyhow::Result;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -482,10 +462,17 @@ impl QdrantClient {
.await?)
}


#[allow(clippy::too_many_arguments)]
pub async fn update_collection(
&self,
collection_name: impl ToString,
optimizers_config: &OptimizersConfigDiff,
optimizers_config: Option<&OptimizersConfigDiff>,
params: Option<&CollectionParamsDiff>,
hnsw_config: Option<&HnswConfigDiff>,
vectors_config: Option<&VectorsConfigDiff>,
quantization_config: Option<&QuantizationConfigDiff>,
sparse_vector_config: Option<&SparseVectorConfig>
) -> Result<CollectionOperationResponse> {
let collection_name = collection_name.to_string();
let collection_name_ref = collection_name.as_str();
Expand All @@ -495,13 +482,13 @@ impl QdrantClient {
let result = collection_api
.update(UpdateCollection {
collection_name: collection_name_ref.to_string(),
optimizers_config: Some(optimizers_config.clone()),
optimizers_config: optimizers_config.cloned(),
timeout: None,
params: None,
hnsw_config: None,
vectors_config: None,
quantization_config: None,
sparse_vectors_config: None,
params: params.cloned(),
hnsw_config: hnsw_config.cloned(),
vectors_config: vectors_config.cloned(),
quantization_config: quantization_config.cloned(),
sparse_vectors_config: sparse_vector_config.cloned(),
})
.await?;

Expand Down

0 comments on commit c70dee1

Please sign in to comment.