Skip to content

Commit e0b959d

Browse files
committed
implement VSIM message
1 parent 4b4225e commit e0b959d

9 files changed

Lines changed: 380 additions & 59 deletions

File tree

src/StackExchange.Redis/Interfaces/IDatabase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,10 +3608,10 @@ bool VectorSetAdd(
36083608
/// <returns>Similar vectors with their similarity scores.</returns>
36093609
/// <remarks><seealso href="https://redis.io/commands/vsim"/></remarks>
36103610
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
3611-
Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByVector(
3611+
Lease<VectorSetSimilaritySearchResult>? VectorSetSimilaritySearchByVector(
36123612
RedisKey key,
36133613
ReadOnlyMemory<float> vector,
3614-
long count = 10,
3614+
int? count = null,
36153615
bool withScores = false,
36163616
bool withAttributes = false,
36173617
double? epsilon = null,
@@ -3640,10 +3640,10 @@ bool VectorSetAdd(
36403640
/// <returns>Similar vectors with their similarity scores.</returns>
36413641
/// <remarks><seealso href="https://redis.io/commands/vsim"/></remarks>
36423642
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
3643-
Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByMember(
3643+
Lease<VectorSetSimilaritySearchResult>? VectorSetSimilaritySearchByMember(
36443644
RedisKey key,
36453645
RedisValue member,
3646-
long count = 10,
3646+
int? count = null,
36473647
bool withScores = false,
36483648
bool withAttributes = false,
36493649
double? epsilon = null,

src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -910,12 +910,12 @@ Task<bool> VectorSetAddAsync(
910910
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
911911
Task<bool> VectorSetSetAttributesJsonAsync(RedisKey key, RedisValue member, string jsonAttributes, CommandFlags flags = CommandFlags.None);
912912

913-
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByVector(RedisKey, ReadOnlyMemory{float}, long, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
913+
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByVector(RedisKey, ReadOnlyMemory{float}, int?, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
914914
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
915-
Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByVectorAsync(
915+
Task<Lease<VectorSetSimilaritySearchResult>?> VectorSetSimilaritySearchByVectorAsync(
916916
RedisKey key,
917917
ReadOnlyMemory<float> vector,
918-
long count = 10,
918+
int? count = null,
919919
bool withScores = false,
920920
bool withAttributes = false,
921921
double? epsilon = null,
@@ -926,12 +926,12 @@ Task<bool> VectorSetAddAsync(
926926
bool disableThreading = false,
927927
CommandFlags flags = CommandFlags.None);
928928

929-
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByMember(RedisKey, RedisValue, long, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
929+
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByMember(RedisKey, RedisValue, int?, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
930930
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
931-
Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByMemberAsync(
931+
Task<Lease<VectorSetSimilaritySearchResult>?> VectorSetSimilaritySearchByMemberAsync(
932932
RedisKey key,
933933
RedisValue member,
934-
long count = 10,
934+
int? count = null,
935935
bool withScores = false,
936936
bool withAttributes = false,
937937
double? epsilon = null,

src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,10 @@ public Task<bool> VectorSetRemoveAsync(RedisKey key, RedisValue member, CommandF
865865
public Task<bool> VectorSetSetAttributesJsonAsync(RedisKey key, RedisValue member, string jsonAttributes, CommandFlags flags = CommandFlags.None) =>
866866
Inner.VectorSetSetAttributesJsonAsync(ToInner(key), member, jsonAttributes, flags);
867867

868-
public Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByVectorAsync(
868+
public Task<Lease<VectorSetSimilaritySearchResult>?> VectorSetSimilaritySearchByVectorAsync(
869869
RedisKey key,
870870
ReadOnlyMemory<float> vector,
871-
long count = 10,
871+
int? count = null,
872872
bool withScores = false,
873873
bool withAttributes = false,
874874
double? epsilon = null,
@@ -880,10 +880,10 @@ public Task<bool> VectorSetSetAttributesJsonAsync(RedisKey key, RedisValue membe
880880
CommandFlags flags = CommandFlags.None) =>
881881
Inner.VectorSetSimilaritySearchByVectorAsync(ToInner(key), vector, count, withScores, withAttributes, epsilon, searchExplorationFactor, filterExpression, maxFilteringEffort, useExactSearch, disableThreading, flags);
882882

883-
public Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByMemberAsync(
883+
public Task<Lease<VectorSetSimilaritySearchResult>?> VectorSetSimilaritySearchByMemberAsync(
884884
RedisKey key,
885885
RedisValue member,
886-
long count = 10,
886+
int? count = null,
887887
bool withScores = false,
888888
bool withAttributes = false,
889889
double? epsilon = null,

src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixedDatabase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,10 @@ public bool VectorSetRemove(RedisKey key, RedisValue member, CommandFlags flags
855855
public bool VectorSetSetAttributesJson(RedisKey key, RedisValue member, string jsonAttributes, CommandFlags flags = CommandFlags.None) =>
856856
Inner.VectorSetSetAttributesJson(ToInner(key), member, jsonAttributes, flags);
857857

858-
public Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByVector(
858+
public Lease<VectorSetSimilaritySearchResult>? VectorSetSimilaritySearchByVector(
859859
RedisKey key,
860860
ReadOnlyMemory<float> vector,
861-
long count = 10,
861+
int? count = null,
862862
bool withScores = false,
863863
bool withAttributes = false,
864864
double? epsilon = null,
@@ -870,10 +870,10 @@ public bool VectorSetSetAttributesJson(RedisKey key, RedisValue member, string j
870870
CommandFlags flags = CommandFlags.None) =>
871871
Inner.VectorSetSimilaritySearchByVector(ToInner(key), vector, count, withScores, withAttributes, epsilon, searchExplorationFactor, filterExpression, maxFilteringEffort, useExactSearch, disableThreading, flags);
872872

873-
public Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByMember(
873+
public Lease<VectorSetSimilaritySearchResult>? VectorSetSimilaritySearchByMember(
874874
RedisKey key,
875875
RedisValue member,
876-
long count = 10,
876+
int? count = null,
877877
bool withScores = false,
878878
bool withAttributes = false,
879879
double? epsilon = null,

src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
[SER001]StackExchange.Redis.IDatabase.VectorSetRandomMembers(StackExchange.Redis.RedisKey key, long count, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.RedisValue[]!
1414
[SER001]StackExchange.Redis.IDatabase.VectorSetRemove(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
1515
[SER001]StackExchange.Redis.IDatabase.VectorSetSetAttributesJson(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, string! jsonAttributes, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
16-
[SER001]StackExchange.Redis.IDatabase.VectorSetSimilaritySearchByMember(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, long count = 10, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.Lease<StackExchange.Redis.VectorSimilarityResult>?
17-
[SER001]StackExchange.Redis.IDatabase.VectorSetSimilaritySearchByVector(StackExchange.Redis.RedisKey key, System.ReadOnlyMemory<float> vector, long count = 10, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.Lease<StackExchange.Redis.VectorSimilarityResult>?
16+
[SER001]StackExchange.Redis.IDatabase.VectorSetSimilaritySearchByMember(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, int? count = null, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.Lease<StackExchange.Redis.VectorSetSimilaritySearchResult>?
17+
[SER001]StackExchange.Redis.IDatabase.VectorSetSimilaritySearchByVector(StackExchange.Redis.RedisKey key, System.ReadOnlyMemory<float> vector, int? count = null, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.Lease<StackExchange.Redis.VectorSetSimilaritySearchResult>?
1818
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetAddAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue element, System.ReadOnlyMemory<float> values, int? reducedDimensions = null, StackExchange.Redis.VectorQuantizationType quantizationType = StackExchange.Redis.VectorQuantizationType.Int8, int? buildExplorationFactor = null, int? maxConnections = null, bool useCheckAndSet = false, string? attributesJson = null, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
1919
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetContainsAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
2020
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetDimensionAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<int>!
@@ -28,8 +28,8 @@
2828
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetRandomMembersAsync(StackExchange.Redis.RedisKey key, long count, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.RedisValue[]!>!
2929
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetRemoveAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
3030
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetSetAttributesJsonAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, string! jsonAttributes, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
31-
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetSimilaritySearchByMemberAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, long count = 10, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.Lease<StackExchange.Redis.VectorSimilarityResult>?>!
32-
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetSimilaritySearchByVectorAsync(StackExchange.Redis.RedisKey key, System.ReadOnlyMemory<float> vector, long count = 10, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.Lease<StackExchange.Redis.VectorSimilarityResult>?>!
31+
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetSimilaritySearchByMemberAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue member, int? count = null, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.Lease<StackExchange.Redis.VectorSetSimilaritySearchResult>?>!
32+
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetSimilaritySearchByVectorAsync(StackExchange.Redis.RedisKey key, System.ReadOnlyMemory<float> vector, int? count = null, bool withScores = false, bool withAttributes = false, double? epsilon = null, int? searchExplorationFactor = null, string? filterExpression = null, int? maxFilteringEffort = null, bool useExactSearch = false, bool disableThreading = false, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.Lease<StackExchange.Redis.VectorSetSimilaritySearchResult>?>!
3333
[SER001]StackExchange.Redis.VectorQuantizationType
3434
[SER001]StackExchange.Redis.VectorQuantizationType.Binary = 3 -> StackExchange.Redis.VectorQuantizationType
3535
[SER001]StackExchange.Redis.VectorQuantizationType.Int8 = 2 -> StackExchange.Redis.VectorQuantizationType
@@ -49,9 +49,9 @@
4949
[SER001]StackExchange.Redis.VectorSetLink.Score.get -> double
5050
[SER001]StackExchange.Redis.VectorSetLink.VectorSetLink() -> void
5151
[SER001]StackExchange.Redis.VectorSetLink.VectorSetLink(StackExchange.Redis.RedisValue member, double score) -> void
52-
[SER001]StackExchange.Redis.VectorSimilarityResult
53-
[SER001]StackExchange.Redis.VectorSimilarityResult.AttributesJson.get -> string?
54-
[SER001]StackExchange.Redis.VectorSimilarityResult.Member.get -> StackExchange.Redis.RedisValue
55-
[SER001]StackExchange.Redis.VectorSimilarityResult.Score.get -> double
56-
[SER001]StackExchange.Redis.VectorSimilarityResult.VectorSimilarityResult() -> void
57-
[SER001]StackExchange.Redis.VectorSimilarityResult.VectorSimilarityResult(StackExchange.Redis.RedisValue member, double score = NaN, string? attributesJson = null) -> void
52+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult
53+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult.AttributesJson.get -> string?
54+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult.Member.get -> StackExchange.Redis.RedisValue
55+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult.Score.get -> double
56+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult.VectorSetSimilaritySearchResult() -> void
57+
[SER001]StackExchange.Redis.VectorSetSimilaritySearchResult.VectorSetSimilaritySearchResult(StackExchange.Redis.RedisValue member, double score = NaN, string? attributesJson = null) -> void

0 commit comments

Comments
 (0)