Skip to content

Commit d6061ea

Browse files
authored
v1.18.0 (#117)
* v1.18.0 * chore: Bump SharpCompress to 0.48.0 * chore: v1.18.0 in Directory.Build.props
1 parent 1b645d5 commit d6061ea

7 files changed

Lines changed: 119 additions & 9 deletions

File tree

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageProjectUrl>https://github.com/qdrant/qdrant-dotnet</PackageProjectUrl>
1010
<PackageReleaseNotes>https://github.com/qdrant/qdrant-dotnet/releases</PackageReleaseNotes>
1111
<PackageTags>qdrant, database, vector, search</PackageTags>
12-
<QdrantVersion>v1.17.0</QdrantVersion>
12+
<QdrantVersion>v1.18.0</QdrantVersion>
1313
</PropertyGroup>
1414

1515
<PropertyGroup>
@@ -29,4 +29,4 @@
2929
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all"/>
3030
</ItemGroup>
3131

32-
</Project>
32+
</Project>

build/Build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<PackageReference Include="Bullseye" Version="6.0.0" />
1212
<PackageReference Include="SimpleExec" Version="12.0.0" />
1313
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
14-
<PackageReference Include="SharpCompress" Version="0.39.0" />
14+
<PackageReference Include="SharpCompress" Version="0.48.0" />
1515
</ItemGroup>
1616

1717
</Project>

build/Main.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System.CommandLine;
22
using System.CommandLine.Invocation;
3-
using System.IO.Compression;
43
using System.Net.Http.Headers;
54
using System.Text.RegularExpressions;
65
using System.Xml.Linq;
76
using Bullseye;
7+
using SharpCompress.Common;
88
using SharpCompress.Readers;
99
using static BuildTargets;
1010
using static Bullseye.Targets;
@@ -87,13 +87,12 @@
8787

8888
var response = await client.GetAsync(url);
8989
await using var stream = await response.Content.ReadAsStreamAsync();
90-
await using var gzip = new GZipStream(stream, CompressionMode.Decompress);
91-
var reader = ReaderFactory.Open(gzip);
90+
using var reader = ReaderFactory.OpenReader(stream);
9291
while (reader.MoveToNextEntry())
9392
{
9493
var entry = reader.Entry;
9594
if (!entry.IsDirectory && protoFileRegex.IsMatch(entry.Key!) && !privateProtoFileRegex.IsMatch(entry.Key!))
96-
reader.WriteEntryToDirectory(protosTagDir);
95+
reader.WriteEntryToDirectory(protosTagDir, new ExtractionOptions { ExtractFullPath = false, Overwrite = true });
9796
}
9897

9998
{

src/Qdrant.Client/IQdrantClient.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,28 @@ Task<UpdateResult> DeletePayloadIndexAsync(
13941394
WriteOrderingType? ordering = null,
13951395
CancellationToken cancellationToken = default);
13961396

1397+
/// <summary>
1398+
/// Creates a new named vector on a collection.
1399+
/// </summary>
1400+
/// <param name="request">The create vector name request.</param>
1401+
/// <param name="cancellationToken">
1402+
/// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
1403+
/// </param>
1404+
Task<UpdateResult> CreateVectorNameAsync(
1405+
CreateVectorNameRequest request,
1406+
CancellationToken cancellationToken = default);
1407+
1408+
/// <summary>
1409+
/// Deletes a named vector from a collection.
1410+
/// </summary>
1411+
/// <param name="request">The delete vector name request.</param>
1412+
/// <param name="cancellationToken">
1413+
/// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.
1414+
/// </param>
1415+
Task<UpdateResult> DeleteVectorNameAsync(
1416+
DeleteVectorNameRequest request,
1417+
CancellationToken cancellationToken = default);
1418+
13971419
/// <summary>
13981420
/// Retrieves closest points based on vector similarity and the given filtering conditions.
13991421
/// </summary>

src/Qdrant.Client/LoggingExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ internal static partial class LoggingExtensions
8080
[LoggerMessage(3014, LogLevel.Debug, "Delete payload field index in '{collection}'")]
8181
public static partial void DeletePayloadIndex(this ILogger logger, string collection);
8282

83+
[LoggerMessage(3032, LogLevel.Debug, "Create vector name '{vectorName}' in '{collection}'")]
84+
public static partial void CreateVectorName(this ILogger logger, string collection, string vectorName);
85+
86+
[LoggerMessage(3033, LogLevel.Debug, "Delete vector name '{vectorName}' in '{collection}'")]
87+
public static partial void DeleteVectorName(this ILogger logger, string collection, string vectorName);
88+
8389
[LoggerMessage(3015, LogLevel.Debug, "Search on '{collection}'")]
8490
public static partial void Search(this ILogger logger, string collection);
8591

src/Qdrant.Client/QdrantClient.cs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,6 @@ public async Task<UpdateResult> UpsertAsync(
14441444
if (updateFilter is not null)
14451445
request.UpdateFilter = updateFilter;
14461446

1447-
_logger.Upsert(collectionName, points.Count);
1448-
14491447
return await UpsertAsync(request, cancellationToken).ConfigureAwait(false);
14501448
}
14511449

@@ -3010,6 +3008,56 @@ public async Task<UpdateResult> DeletePayloadIndexAsync(
30103008
}
30113009
}
30123010

3011+
/// <inheritdoc />
3012+
public async Task<UpdateResult> CreateVectorNameAsync(
3013+
CreateVectorNameRequest request,
3014+
CancellationToken cancellationToken = default)
3015+
{
3016+
_logger.CreateVectorName(request.CollectionName, request.VectorName);
3017+
3018+
try
3019+
{
3020+
var response = await _pointsClient.CreateVectorNameAsync(
3021+
request,
3022+
deadline: _grpcTimeout == default ? null : DateTime.UtcNow.Add(_grpcTimeout),
3023+
cancellationToken: cancellationToken)
3024+
.ConfigureAwait(false);
3025+
3026+
return response.Result;
3027+
}
3028+
catch (Exception e)
3029+
{
3030+
_logger.OperationFailed(nameof(LoggingExtensions.CreateVectorName), e);
3031+
3032+
throw;
3033+
}
3034+
}
3035+
3036+
/// <inheritdoc />
3037+
public async Task<UpdateResult> DeleteVectorNameAsync(
3038+
DeleteVectorNameRequest request,
3039+
CancellationToken cancellationToken = default)
3040+
{
3041+
_logger.DeleteVectorName(request.CollectionName, request.VectorName);
3042+
3043+
try
3044+
{
3045+
var response = await _pointsClient.DeleteVectorNameAsync(
3046+
request,
3047+
deadline: _grpcTimeout == default ? null : DateTime.UtcNow.Add(_grpcTimeout),
3048+
cancellationToken: cancellationToken)
3049+
.ConfigureAwait(false);
3050+
3051+
return response.Result;
3052+
}
3053+
catch (Exception e)
3054+
{
3055+
_logger.OperationFailed(nameof(LoggingExtensions.DeleteVectorName), e);
3056+
3057+
throw;
3058+
}
3059+
}
3060+
30133061
/// <summary>
30143062
/// Retrieves closest points based on vector similarity and the given filtering conditions.
30153063
/// </summary>

tests/Qdrant.Client.Tests/CollectionTests.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,41 @@ public async Task DeleteAlias()
195195
Assert.Empty(await _client.ListCollectionAliasesAsync("collection_1"));
196196
}
197197

198+
[Fact]
199+
public async Task CreateAndDeleteVector()
200+
{
201+
const string collectionName = "collection_1";
202+
203+
await _client.CreateCollectionAsync(collectionName, new VectorParamsMap
204+
{
205+
Map = { ["vector_1"] = new() { Size = 4, Distance = Distance.Dot } }
206+
});
207+
208+
await _client.CreateVectorNameAsync(new()
209+
{
210+
CollectionName = collectionName,
211+
VectorName = "vector_2",
212+
Wait = true,
213+
DenseConfig = new() { Size = 8, Distance = Distance.Cosine }
214+
});
215+
216+
var info = await _client.GetCollectionInfoAsync(collectionName);
217+
var vectors = info.Config.Params.VectorsConfig.ParamsMap.Map;
218+
vectors.Should().HaveCount(2).And.ContainKeys("vector_1", "vector_2");
219+
220+
await _client.DeleteVectorNameAsync(new()
221+
{
222+
CollectionName = collectionName,
223+
VectorName = "vector_2",
224+
Wait = true
225+
});
226+
227+
info = await _client.GetCollectionInfoAsync(collectionName);
228+
vectors = info.Config.Params.VectorsConfig.ParamsMap.Map;
229+
vectors.Should().HaveCount(1).And.ContainKeys("vector_1");
230+
}
231+
232+
198233
public async Task InitializeAsync()
199234
{
200235
foreach (var collection in await _client.ListCollectionsAsync())

0 commit comments

Comments
 (0)