Skip to content

Commit

Permalink
v1.8.0 (#46)
Browse files Browse the repository at this point in the history
* v1.8.0

* chore: typo fix

* chore: StartFrom conversions

* chore: bump to v1.8.0
  • Loading branch information
Anush008 authored Mar 6, 2024
1 parent e48e8a4 commit 6dd9436
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/qdrant/qdrant-dotnet</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/qdrant/qdrant-dotnet/releases</PackageReleaseNotes>
<PackageTags>qdrant, database, vector, search</PackageTags>
<QdrantVersion>v1.7.0</QdrantVersion>
<QdrantVersion>v1.8.0</QdrantVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

Directory.CreateDirectory(protosTagDir);
Console.WriteLine($"Downloading protos for tag {qdrantVersion} to {protosTagDir}");
var url = $"https://api.github.com/repos/qdrant/qdrant/tarball/refs/tags/{qdrantVersion}";
var url = $"https://api.github.com/repos/qdrant/qdrant/tarball/{qdrantVersion}";
var protoFileRegex = new Regex(".*?lib/api/src/grpc/proto/.*?.proto");
var privateProtoFileRegex = new Regex("(?:.*?internal.*?|raft_service|health_check|shard_snapshots_service).proto");
var client = new HttpClient
Expand Down
31 changes: 31 additions & 0 deletions src/Qdrant.Client/Grpc/Conditions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Google.Protobuf.WellKnownTypes;

namespace Qdrant.Client.Grpc;

/// <summary>
Expand Down Expand Up @@ -253,6 +255,35 @@ public static Condition ValuesCount(string field, ValuesCount valuesCount) =>
/// <param name="filter">The filter to nest</param>
/// <returns>a new instance of <see cref="Condition"/></returns>
public static Condition Filter(Filter filter) => new() { Filter = filter };

/// <summary>
/// Matches records where the given field has values inside the provided DateTime range.
/// </summary>
/// <param name="field">The name of the field</param>
/// <param name="lt">Match time lower than the specified <see cref="DateTime"/> (Upper bound)</param>
/// <param name="gt">Match time higher than the specified <see cref="DateTime"/> (Lower bound)</param>
/// <param name="gte">Match time higher or equal to the specified <see cref="DateTime"/> (Lower bound)</param>
/// <param name="lte">Match time lower or equal to the the specified <see cref="DateTime"/> (Upper bound)</param>
/// <returns>A new instance of <see cref="Condition"/></returns>
public static Condition DatetimeRange(string field, DateTime? lt = null, DateTime? gt = null, DateTime? gte = null, DateTime? lte = null)
{
var datetimeRange = new DatetimeRange();

if (lt is not null)
datetimeRange.Lt = Timestamp.FromDateTime(lt.Value);

if (gt is not null)
datetimeRange.Gt = Timestamp.FromDateTime(gt.Value);

if (gte is not null)
datetimeRange.Gte = Timestamp.FromDateTime(gte.Value);

if (lte is not null)
datetimeRange.Lte = Timestamp.FromDateTime(lte.Value);

return new Condition { Field = new FieldCondition { Key = field, DatetimeRange = datetimeRange } };
}

}


14 changes: 14 additions & 0 deletions src/Qdrant.Client/Grpc/OrderBy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Qdrant.Client.Grpc;

/// <summary>
/// Order the records by a payload field
/// </summary>
public partial class OrderBy
{
/// <summary>
/// Implicitly converts a string to a new instance of <see cref="OrderBy"/>
/// </summary>
/// <param name="key">key</param>
/// <returns>a new instance of <see cref="OrderBy"/></returns>
public static implicit operator OrderBy(string key) => new() { Key = key };
}
44 changes: 44 additions & 0 deletions src/Qdrant.Client/Grpc/StartFrom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Google.Protobuf.WellKnownTypes;

namespace Qdrant.Client.Grpc;

/// <summary>
/// Start ordered records from the specified value
/// </summary>
public partial class StartFrom
{
/// <summary>
/// Implicitly converts a datetime string to a new instance of <see cref="StartFrom"/>
/// </summary>
/// <param name="value">Datetime string value</param>
/// <returns>a new instance of <see cref="StartFrom"/></returns>
public static implicit operator StartFrom(string value) => new() { Datetime = value };

/// <summary>
/// Implicitly converts a double to a new instance of <see cref="StartFrom"/>
/// </summary>
/// <param name="value">Double value</param>
/// <returns>a new instance of <see cref="StartFrom"/></returns>
public static implicit operator StartFrom(double value) => new() { Float = value };

/// <summary>
/// Implicitly converts an integer to a new instance of <see cref="StartFrom"/>
/// </summary>
/// <param name="value">Integer value</param>
/// <returns>a new instance of <see cref="StartFrom"/></returns>
public static implicit operator StartFrom(int value) => new() { Integer = value };

/// <summary>
/// Implicitly converts <see cref="Datetime"/> to a new instance of <see cref="StartFrom"/>
/// </summary>
/// <param name="value">Integer value</param>
/// <returns>a new instance of <see cref="StartFrom"/></returns>
public static implicit operator StartFrom(DateTime value) => new() { Timestamp = Timestamp.FromDateTime(value) };

/// <summary>
/// Implicitly converts <see cref="Timestamp"/> to a new instance of <see cref="StartFrom"/>
/// </summary>
/// <param name="value">Integer value</param>
/// <returns>a new instance of <see cref="StartFrom"/></returns>
public static implicit operator StartFrom(Timestamp value) => new() { Timestamp = value };
}
7 changes: 7 additions & 0 deletions src/Qdrant.Client/LoggingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace Qdrant.Client;

internal static partial class LoggingExtensions
{
#region Collection management

[LoggerMessage(1000, LogLevel.Debug, "Create collection '{collection}'")]
public static partial void CreateCollection(this ILogger logger, string collection);

Expand All @@ -19,6 +21,11 @@ internal static partial class LoggingExtensions
[LoggerMessage(1005, LogLevel.Debug, "Update collection '{collection}'")]
public static partial void UpdateCollection(this ILogger logger, string collection);

[LoggerMessage(1006, LogLevel.Debug, "Collection exists '{collection}'")]
public static partial void CollectionExists(this ILogger logger, string collection);

#endregion Collection management

#region Alias management

[LoggerMessage(2000, LogLevel.Debug, "Create alias '{alias}' for collection '{collection}'")]
Expand Down
Loading

0 comments on commit 6dd9436

Please sign in to comment.