@@ -136,6 +136,7 @@ private QdrantClient(
136136 /// </param>
137137 /// <param name="shardingMethod">Sharding method.</param>
138138 /// <param name="sparseVectorsConfig">Configuration for sparse vectors.</param>
139+ /// <param name="strictModeConfig">Configuration for strict mode.</param>
139140 /// <param name="cancellationToken">
140141 /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
141142 /// </param>
@@ -153,12 +154,13 @@ public Task CreateCollectionAsync(
153154 string ? initFromCollection = null ,
154155 ShardingMethod ? shardingMethod = null ,
155156 SparseVectorConfig ? sparseVectorsConfig = null ,
157+ StrictModeConfig ? strictModeConfig = null ,
156158 TimeSpan ? timeout = null ,
157159 CancellationToken cancellationToken = default )
158160 => CreateCollectionAsync (
159161 collectionName , new VectorsConfig { Params = vectorsConfig } , shardNumber , replicationFactor ,
160162 writeConsistencyFactor , onDiskPayload , hnswConfig , optimizersConfig , walConfig , quantizationConfig ,
161- initFromCollection , shardingMethod , sparseVectorsConfig , timeout , cancellationToken ) ;
163+ initFromCollection , shardingMethod , sparseVectorsConfig , strictModeConfig , timeout , cancellationToken ) ;
162164
163165 /// <summary>
164166 /// Creates a new collection with the given parameters.
@@ -196,6 +198,7 @@ public Task CreateCollectionAsync(
196198 /// </param>
197199 /// <param name="shardingMethod">Sharding method.</param>
198200 /// <param name="sparseVectorsConfig">Configuration for sparse vectors.</param>
201+ /// <param name="strictModeConfig">Configuration for strict mode.</param>
199202 /// <param name="cancellationToken">
200203 /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
201204 /// </param>
@@ -213,12 +216,13 @@ public Task CreateCollectionAsync(
213216 string ? initFromCollection = null ,
214217 ShardingMethod ? shardingMethod = null ,
215218 SparseVectorConfig ? sparseVectorsConfig = null ,
219+ StrictModeConfig ? strictModeConfig = null ,
216220 TimeSpan ? timeout = null ,
217221 CancellationToken cancellationToken = default )
218222 => CreateCollectionAsync (
219223 collectionName , vectorsConfig == null ? null : new VectorsConfig { ParamsMap = vectorsConfig } , shardNumber , replicationFactor ,
220224 writeConsistencyFactor , onDiskPayload , hnswConfig , optimizersConfig , walConfig , quantizationConfig ,
221- initFromCollection , shardingMethod , sparseVectorsConfig , timeout , cancellationToken ) ;
225+ initFromCollection , shardingMethod , sparseVectorsConfig , strictModeConfig , timeout , cancellationToken ) ;
222226
223227 private async Task CreateCollectionAsync (
224228 string collectionName ,
@@ -234,6 +238,7 @@ private async Task CreateCollectionAsync(
234238 string ? initFromCollection = null ,
235239 ShardingMethod ? shardingMethod = null ,
236240 SparseVectorConfig ? sparseVectorsConfig = null ,
241+ StrictModeConfig ? strictModeConfig = null ,
237242 TimeSpan ? timeout = null ,
238243 CancellationToken cancellationToken = default )
239244 {
@@ -250,6 +255,7 @@ private async Task CreateCollectionAsync(
250255 WalConfig = walConfig ,
251256 QuantizationConfig = quantizationConfig ,
252257 SparseVectorsConfig = sparseVectorsConfig ,
258+ StrictModeConfig = strictModeConfig ,
253259 } ;
254260
255261 if ( timeout is not null )
@@ -321,6 +327,7 @@ private async Task CreateCollectionAsync(
321327 /// </param>
322328 /// <param name="shardingMethod">Sharding method.</param>
323329 /// <param name="sparseVectorsConfig">Configuration for sparse vectors.</param>
330+ /// <param name="strictModeConfig">Configuration for strict mode.</param>
324331 /// <param name="cancellationToken">
325332 /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
326333 /// </param>
@@ -338,12 +345,13 @@ public Task RecreateCollectionAsync(
338345 string ? initFromCollection = null ,
339346 ShardingMethod ? shardingMethod = null ,
340347 SparseVectorConfig ? sparseVectorsConfig = null ,
348+ StrictModeConfig ? strictModeConfig = null ,
341349 TimeSpan ? timeout = null ,
342350 CancellationToken cancellationToken = default )
343351 => RecreateCollectionAsync (
344352 collectionName , new VectorsConfig { Params = vectorsConfig } , shardNumber , replicationFactor ,
345353 writeConsistencyFactor , onDiskPayload , hnswConfig , optimizersConfig , walConfig , quantizationConfig ,
346- initFromCollection , shardingMethod , sparseVectorsConfig , timeout , cancellationToken ) ;
354+ initFromCollection , shardingMethod , sparseVectorsConfig , strictModeConfig , timeout , cancellationToken ) ;
347355
348356 /// <summary>
349357 /// Deletes a collection if one exists, and creates a new collection with the given parameters.
@@ -381,6 +389,7 @@ public Task RecreateCollectionAsync(
381389 /// </param>
382390 /// <param name="shardingMethod">Sharding method.</param>
383391 /// <param name="sparseVectorsConfig">Configuration for sparse vectors.</param>
392+ /// <param name="strictModeConfig">Configuration for strict mode.</param>
384393 /// <param name="cancellationToken">
385394 /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
386395 /// </param>
@@ -398,12 +407,13 @@ public Task RecreateCollectionAsync(
398407 string ? initFromCollection = null ,
399408 ShardingMethod ? shardingMethod = null ,
400409 SparseVectorConfig ? sparseVectorsConfig = null ,
410+ StrictModeConfig ? strictModeConfig = null ,
401411 TimeSpan ? timeout = null ,
402412 CancellationToken cancellationToken = default )
403413 => RecreateCollectionAsync (
404414 collectionName , vectorsConfig == null ? null : new VectorsConfig { ParamsMap = vectorsConfig } , shardNumber , replicationFactor ,
405415 writeConsistencyFactor , onDiskPayload , hnswConfig , optimizersConfig , walConfig , quantizationConfig ,
406- initFromCollection , shardingMethod , sparseVectorsConfig , timeout , cancellationToken ) ;
416+ initFromCollection , shardingMethod , sparseVectorsConfig , strictModeConfig , timeout , cancellationToken ) ;
407417
408418 private async Task RecreateCollectionAsync (
409419 string collectionName ,
@@ -419,6 +429,7 @@ private async Task RecreateCollectionAsync(
419429 string ? initFromCollection = null ,
420430 ShardingMethod ? shardingMethod = null ,
421431 SparseVectorConfig ? sparseVectorsConfig = null ,
432+ StrictModeConfig ? strictModeConfig = null ,
422433 TimeSpan ? timeout = null ,
423434 CancellationToken cancellationToken = default )
424435 {
@@ -429,7 +440,7 @@ private async Task RecreateCollectionAsync(
429440 await CreateCollectionAsync (
430441 collectionName , vectorsConfig , shardNumber , replicationFactor ,
431442 writeConsistencyFactor , onDiskPayload , hnswConfig , optimizersConfig , walConfig , quantizationConfig ,
432- initFromCollection , shardingMethod , sparseVectorsConfig , timeout , cancellationToken )
443+ initFromCollection , shardingMethod , sparseVectorsConfig , strictModeConfig , timeout , cancellationToken )
433444 . ConfigureAwait ( false ) ;
434445 }
435446
@@ -3745,6 +3756,205 @@ public async Task<IReadOnlyList<BatchResult>> DiscoverBatchAsync(
37453756 }
37463757 }
37473758
3759+ /// <summary>
3760+ /// Perform facet counts. For each value in the field, count the number of points that have this value and match the conditions.
3761+ /// </summary>
3762+ /// <param name="collectionName">The name of the collection.</param>
3763+ /// <param name="key">Payload key of the facet.</param>
3764+ /// <param name="filter">Filter conditions - return only those points that satisfy the specified conditions.</param>
3765+ /// <param name="limit">Max number of facets.</param>
3766+ /// <param name="exact">If true, return exact counts, slower but useful for debugging purposes.</param>
3767+ /// <param name="readConsistency">Options for specifying read consistency guarantees.</param>
3768+ /// <param name="shardKeySelector">TSpecify in which shards to look for the points, if not specified - look in all shards.</param>
3769+ /// <param name="timeout">If set, overrides global timeout setting for this request. Unit is seconds.</param>
3770+ /// <param name="cancellationToken">
3771+ /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
3772+ /// </param>
3773+ public async Task < FacetResponse > FacetAsync (
3774+ string collectionName ,
3775+ string key ,
3776+ Filter ? filter = null ,
3777+ ulong limit = 10 ,
3778+ bool exact = false , // If true, return exact counts, slower but useful for debugging purposes. Default is false.
3779+ ReadConsistency ? readConsistency = null ,
3780+ ShardKeySelector ? shardKeySelector = null ,
3781+ TimeSpan ? timeout = null ,
3782+ CancellationToken cancellationToken = default )
3783+ {
3784+ var request = new FacetCounts
3785+ {
3786+ CollectionName = collectionName ,
3787+ Key = key ,
3788+ Limit = limit ,
3789+ Exact = exact
3790+ } ;
3791+
3792+ if ( filter is not null )
3793+ request . Filter = filter ;
3794+
3795+ if ( readConsistency is not null )
3796+ request . ReadConsistency = readConsistency ;
3797+
3798+ if ( timeout is not null )
3799+ request . Timeout = ConvertTimeout ( timeout ) ;
3800+
3801+ if ( shardKeySelector is not null )
3802+ request . ShardKeySelector = shardKeySelector ;
3803+
3804+ _logger . Facet ( collectionName ) ;
3805+
3806+ try
3807+ {
3808+ var response = await _pointsClient . FacetAsync (
3809+ request ,
3810+ deadline : _grpcTimeout == default ? null : DateTime . UtcNow . Add ( _grpcTimeout ) ,
3811+ cancellationToken : cancellationToken )
3812+ . ConfigureAwait ( false ) ;
3813+
3814+ return response ;
3815+ }
3816+ catch ( Exception e )
3817+ {
3818+ _logger . OperationFailed ( nameof ( LoggingExtensions . Facet ) , e ) ;
3819+
3820+ throw ;
3821+ }
3822+ }
3823+
3824+ /// <summary>
3825+ /// Compute distance matrix for sampled points with a pair based output format.
3826+ /// </summary>
3827+ /// <param name="collectionName">The name of the collection.</param>
3828+ /// <param name="filter">Filter conditions - return only those points that satisfy the specified conditions.</param>
3829+ /// <param name="sample">How many points to select and search within.</param>
3830+ /// <param name="limit">How many neighbours per sample to find.</param>
3831+ /// <param name="usingVector">Define which vector to use for querying. If missing, the default vector is is used.</param>
3832+ /// <param name="readConsistency">Options for specifying read consistency guarantees.</param>
3833+ /// <param name="shardKeySelector">TSpecify in which shards to look for the points, if not specified - look in all shards.</param>
3834+ /// <param name="timeout">If set, overrides global timeout setting for this request. Unit is seconds.</param>
3835+ /// <param name="cancellationToken">
3836+ /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
3837+ /// </param>
3838+ public async Task < SearchMatrixPairs > SearchMatrixPairsAsync (
3839+ string collectionName ,
3840+ Filter ? filter = null ,
3841+ ulong sample = 10 ,
3842+ ulong limit = 3 ,
3843+ string ? usingVector = null ,
3844+ ReadConsistency ? readConsistency = null ,
3845+ ShardKeySelector ? shardKeySelector = null ,
3846+ TimeSpan ? timeout = null ,
3847+ CancellationToken cancellationToken = default )
3848+ {
3849+ var request = new SearchMatrixPoints
3850+ {
3851+ CollectionName = collectionName ,
3852+ Sample = sample ,
3853+ Limit = limit
3854+ } ;
3855+
3856+ if ( usingVector is not null )
3857+ request . Using = usingVector ;
3858+
3859+ if ( filter is not null )
3860+ request . Filter = filter ;
3861+
3862+ if ( readConsistency is not null )
3863+ request . ReadConsistency = readConsistency ;
3864+
3865+ if ( timeout is not null )
3866+ request . Timeout = ConvertTimeout ( timeout ) ;
3867+
3868+ if ( shardKeySelector is not null )
3869+ request . ShardKeySelector = shardKeySelector ;
3870+
3871+ _logger . SearchMatrixPairs ( collectionName ) ;
3872+
3873+ try
3874+ {
3875+ var response = await _pointsClient . SearchMatrixPairsAsync (
3876+ request ,
3877+ deadline : _grpcTimeout == default ? null : DateTime . UtcNow . Add ( _grpcTimeout ) ,
3878+ cancellationToken : cancellationToken )
3879+ . ConfigureAwait ( false ) ;
3880+
3881+ return response . Result ;
3882+ }
3883+ catch ( Exception e )
3884+ {
3885+ _logger . OperationFailed ( nameof ( LoggingExtensions . SearchMatrixPairs ) , e ) ;
3886+
3887+ throw ;
3888+ }
3889+ }
3890+
3891+ /// <summary>
3892+ /// Compute distance matrix for sampled points with an offset based output format.
3893+ /// </summary>
3894+ /// <param name="collectionName">The name of the collection.</param>
3895+ /// <param name="filter">Filter conditions - return only those points that satisfy the specified conditions.</param>
3896+ /// <param name="sample">How many points to select and search within.</param>
3897+ /// <param name="limit">How many neighbours per sample to find.</param>
3898+ /// <param name="usingVector">Define which vector to use for querying. If missing, the default vector is is used.</param>
3899+ /// <param name="readConsistency">Options for specifying read consistency guarantees.</param>
3900+ /// <param name="shardKeySelector">TSpecify in which shards to look for the points, if not specified - look in all shards.</param>
3901+ /// <param name="timeout">If set, overrides global timeout setting for this request. Unit is seconds.</param>
3902+ /// <param name="cancellationToken">
3903+ /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
3904+ /// </param>
3905+ public async Task < SearchMatrixOffsets > SearchMatrixOffsetsAsync (
3906+ string collectionName ,
3907+ Filter ? filter = null ,
3908+ ulong sample = 10 ,
3909+ ulong limit = 3 ,
3910+ string ? usingVector = null ,
3911+ ReadConsistency ? readConsistency = null ,
3912+ ShardKeySelector ? shardKeySelector = null ,
3913+ TimeSpan ? timeout = null ,
3914+ CancellationToken cancellationToken = default )
3915+ {
3916+ var request = new SearchMatrixPoints
3917+ {
3918+ CollectionName = collectionName ,
3919+ Sample = sample ,
3920+ Limit = limit
3921+ } ;
3922+
3923+ if ( usingVector is not null )
3924+ request . Using = usingVector ;
3925+
3926+ if ( filter is not null )
3927+ request . Filter = filter ;
3928+
3929+ if ( readConsistency is not null )
3930+ request . ReadConsistency = readConsistency ;
3931+
3932+ if ( timeout is not null )
3933+ request . Timeout = ConvertTimeout ( timeout ) ;
3934+
3935+ if ( shardKeySelector is not null )
3936+ request . ShardKeySelector = shardKeySelector ;
3937+
3938+ _logger . SearchMatrixOffsets ( collectionName ) ;
3939+
3940+ try
3941+ {
3942+ var response = await _pointsClient . SearchMatrixOffsetsAsync (
3943+ request ,
3944+ deadline : _grpcTimeout == default ? null : DateTime . UtcNow . Add ( _grpcTimeout ) ,
3945+ cancellationToken : cancellationToken )
3946+ . ConfigureAwait ( false ) ;
3947+
3948+ return response . Result ;
3949+ }
3950+ catch ( Exception e )
3951+ {
3952+ _logger . OperationFailed ( nameof ( LoggingExtensions . SearchMatrixOffsets ) , e ) ;
3953+
3954+ throw ;
3955+ }
3956+ }
3957+
37483958 #endregion Point management
37493959
37503960 #region Snapshot management
0 commit comments