From 26f5dd8cd7f71ce2333197eed29ffd3f20adf356 Mon Sep 17 00:00:00 2001 From: Anuj Modi Date: Wed, 30 Apr 2025 10:33:02 -0400 Subject: [PATCH] Breaking changes (combined): - absorb strong-naming from #417 - fix embarrassing tyop --- Directory.Build.props | 2 ++ NRedisStack.snk | Bin 0 -> 596 bytes .../PublicAPI/PublicAPI.Shipped.txt | 34 +++++++++--------- .../PublicAPI/PublicAPI.Unshipped.txt | 2 +- src/NRedisStack/Search/Schema.cs | 14 ++++---- .../Search/IndexCreationTests.cs | 12 +++---- 6 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 NRedisStack.snk diff --git a/Directory.Build.props b/Directory.Build.props index 80453fb9..077da3ac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,6 +23,8 @@ true true true + ../../NRedisStack.snk + True $(NoWarn);CS1591 $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows()))) diff --git a/NRedisStack.snk b/NRedisStack.snk new file mode 100644 index 0000000000000000000000000000000000000000..f11f90ec1f02224192a751d87f0ac984e312b08d GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097pTo2&6g{ViC>`je58wa)8jM*oSY+|)g zepm`yymI1`c=0gf6B)WE1Mn&e29q!_czjtP>gys=mkoB)Ks7OeL1~U-W6(%ZpR1Yk zh}d5#!HBM9`N#d!k$d!ZbVS_R3N|E>nIR!r>OC69>9|fhjd&$Ia<;AT%V)mXeM`?5 zz~K>AKN-q+9k4u_-wrZgQpP4{?ryK;P91es8CS++8j<%i-bgnHd`nzVP501uo&qc& z%k){hj2g@b^7H%=9f{YE_J+0=mf?uf-DaZS;Xx}ZwVyCwk?*KKJaLIdq5+_T}LeH6sa1#0kt`g5V!lqR-hWh{j^~E2?4uboC zq~BLIV{Ei literal 0 HcmV?d00001 diff --git a/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt b/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt index e3cae9d9..bbb8ea66 100644 --- a/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt +++ b/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt @@ -1352,7 +1352,7 @@ virtual NRedisStack.Search.Aggregation.Reducer.AddOwnArgs(System.Collections.Gen virtual NRedisStack.Search.Aggregation.Reducer.GetOwnArgsCount() -> int NRedisStack.Search.Schema.AddFlatVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> NRedisStack.Search.Schema! NRedisStack.Search.Schema.AddHnswVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, int maxOutgoingConnections = 16, int maxConnectedNeighbors = 200, int maxTopCandidates = 10, double boundaryFactor = 0.01, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> NRedisStack.Search.Schema! -NRedisStack.Search.Schema.AddSvsVanamaVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm compressionAlgorithm = NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm.NotSpecified, int constructionWindowSize = 200, int graphMaxDegree = 32, int searchWindowSize = 10, double rangeSearchApproximationFactor = 0.01, int trainingThreshold = 0, int reducedDimensions = 0, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> NRedisStack.Search.Schema! +NRedisStack.Search.Schema.AddSvsVamanaVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm compressionAlgorithm = NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm.NotSpecified, int constructionWindowSize = 200, int graphMaxDegree = 32, int searchWindowSize = 10, double rangeSearchApproximationFactor = 0.01, int trainingThreshold = 0, int reducedDimensions = 0, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> NRedisStack.Search.Schema! NRedisStack.Search.Schema.FlatVectorField NRedisStack.Search.Schema.FlatVectorField.FlatVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> void NRedisStack.Search.Schema.HnswVectorField @@ -1365,22 +1365,22 @@ NRedisStack.Search.Schema.HnswVectorField.MaxOutgoingConnections.get -> int NRedisStack.Search.Schema.HnswVectorField.MaxOutgoingConnections.set -> void NRedisStack.Search.Schema.HnswVectorField.MaxTopCandidates.get -> int NRedisStack.Search.Schema.HnswVectorField.MaxTopCandidates.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField -NRedisStack.Search.Schema.SvsVanamaVectorField.CompressionAlgorithm.get -> NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm -NRedisStack.Search.Schema.SvsVanamaVectorField.CompressionAlgorithm.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.ConstructionWindowSize.get -> int -NRedisStack.Search.Schema.SvsVanamaVectorField.ConstructionWindowSize.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.GraphMaxDegree.get -> int -NRedisStack.Search.Schema.SvsVanamaVectorField.GraphMaxDegree.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.RangeSearchApproximationFactor.get -> double -NRedisStack.Search.Schema.SvsVanamaVectorField.RangeSearchApproximationFactor.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.ReducedDimensions.get -> int -NRedisStack.Search.Schema.SvsVanamaVectorField.ReducedDimensions.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.SearchWindowSize.get -> int -NRedisStack.Search.Schema.SvsVanamaVectorField.SearchWindowSize.set -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.SvsVanamaVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> void -NRedisStack.Search.Schema.SvsVanamaVectorField.TrainingThreshold.get -> int -NRedisStack.Search.Schema.SvsVanamaVectorField.TrainingThreshold.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField +NRedisStack.Search.Schema.SvsVamanaVectorField.CompressionAlgorithm.get -> NRedisStack.Search.Schema.VectorField.VectorCompressionAlgorithm +NRedisStack.Search.Schema.SvsVamanaVectorField.CompressionAlgorithm.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.ConstructionWindowSize.get -> int +NRedisStack.Search.Schema.SvsVamanaVectorField.ConstructionWindowSize.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.GraphMaxDegree.get -> int +NRedisStack.Search.Schema.SvsVamanaVectorField.GraphMaxDegree.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.RangeSearchApproximationFactor.get -> double +NRedisStack.Search.Schema.SvsVamanaVectorField.RangeSearchApproximationFactor.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.ReducedDimensions.get -> int +NRedisStack.Search.Schema.SvsVamanaVectorField.ReducedDimensions.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.SearchWindowSize.get -> int +NRedisStack.Search.Schema.SvsVamanaVectorField.SearchWindowSize.set -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.SvsVamanaVectorField(NRedisStack.Search.FieldName! name, NRedisStack.Search.Schema.VectorField.VectorType type, int dimensions, NRedisStack.Search.Schema.VectorField.VectorDistanceMetric distanceMetric, System.Collections.Generic.Dictionary? attributes = null, bool missingIndex = false) -> void +NRedisStack.Search.Schema.SvsVamanaVectorField.TrainingThreshold.get -> int +NRedisStack.Search.Schema.SvsVamanaVectorField.TrainingThreshold.set -> void NRedisStack.Search.Schema.VectorField.Dimensions.get -> int NRedisStack.Search.Schema.VectorField.Dimensions.set -> void NRedisStack.Search.Schema.VectorField.DistanceMetric.get -> NRedisStack.Search.Schema.VectorField.VectorDistanceMetric diff --git a/src/NRedisStack/PublicAPI/PublicAPI.Unshipped.txt b/src/NRedisStack/PublicAPI/PublicAPI.Unshipped.txt index 7dc5c581..815c9200 100644 --- a/src/NRedisStack/PublicAPI/PublicAPI.Unshipped.txt +++ b/src/NRedisStack/PublicAPI/PublicAPI.Unshipped.txt @@ -1 +1 @@ -#nullable enable +#nullable enable \ No newline at end of file diff --git a/src/NRedisStack/Search/Schema.cs b/src/NRedisStack/Search/Schema.cs index 716d8b9b..3bd07000 100644 --- a/src/NRedisStack/Search/Schema.cs +++ b/src/NRedisStack/Search/Schema.cs @@ -533,7 +533,7 @@ internal override void AddDirectAttributes(List args) /// /// A that uses the algorithm. /// - public class SvsVanamaVectorField( + public class SvsVamanaVectorField( FieldName name, VectorType type, int dimensions, @@ -890,17 +890,17 @@ public Schema AddHnswVectorField(FieldName name, VectorType type, int dimensions /// Add a vector to the schema. /// /// Note that reducedDimensions is only applicable when using LeanVec compression. - public Schema AddSvsVanamaVectorField(FieldName name, VectorType type, int dimensions, VectorDistanceMetric distanceMetric, + public Schema AddSvsVamanaVectorField(FieldName name, VectorType type, int dimensions, VectorDistanceMetric distanceMetric, VectorCompressionAlgorithm compressionAlgorithm = VectorCompressionAlgorithm.NotSpecified, - int constructionWindowSize = SvsVanamaVectorField.DEFAULT_CONSTRUCTION_WINDOW_SIZE, - int graphMaxDegree = SvsVanamaVectorField.DEFAULT_GRAPH_MAX_DEGREE, - int searchWindowSize = SvsVanamaVectorField.DEFAULT_SEARCH_WINDOW_SIZE, - double rangeSearchApproximationFactor = SvsVanamaVectorField.DEFAULT_EPSILON, + int constructionWindowSize = SvsVamanaVectorField.DEFAULT_CONSTRUCTION_WINDOW_SIZE, + int graphMaxDegree = SvsVamanaVectorField.DEFAULT_GRAPH_MAX_DEGREE, + int searchWindowSize = SvsVamanaVectorField.DEFAULT_SEARCH_WINDOW_SIZE, + double rangeSearchApproximationFactor = SvsVamanaVectorField.DEFAULT_EPSILON, int trainingThreshold = 0, int reducedDimensions = 0, Dictionary? attributes = null, bool missingIndex = false) { - Fields.Add(new SvsVanamaVectorField(name, type, dimensions, distanceMetric, attributes, missingIndex) + Fields.Add(new SvsVamanaVectorField(name, type, dimensions, distanceMetric, attributes, missingIndex) { CompressionAlgorithm = compressionAlgorithm, ConstructionWindowSize = constructionWindowSize, diff --git a/tests/NRedisStack.Tests/Search/IndexCreationTests.cs b/tests/NRedisStack.Tests/Search/IndexCreationTests.cs index a9475b5a..4704f4c9 100644 --- a/tests/NRedisStack.Tests/Search/IndexCreationTests.cs +++ b/tests/NRedisStack.Tests/Search/IndexCreationTests.cs @@ -316,9 +316,9 @@ public void TestCreate_Float16_Int32_VectorField_Svs(string endpointId) IDatabase db = GetCleanDatabase(endpointId); // ReSharper disable once RedundantArgumentDefaultValue var ft = db.FT(2); - var schema = new Schema().AddSvsVanamaVectorField("v", Schema.VectorField.VectorType.FLOAT16, 5, + var schema = new Schema().AddSvsVamanaVectorField("v", Schema.VectorField.VectorType.FLOAT16, 5, Schema.VectorField.VectorDistanceMetric.EuclideanDistance) - .AddSvsVanamaVectorField("v2", Schema.VectorField.VectorType.FLOAT32, 4, + .AddSvsVamanaVectorField("v2", Schema.VectorField.VectorType.FLOAT32, 4, Schema.VectorField.VectorDistanceMetric.EuclideanDistance); var cmd = SearchCommandBuilder.Create("idx", FTCreateParams.CreateParams(), schema).ToString(); @@ -350,10 +350,10 @@ public void TestCreate_Float16_Int32_VectorField_Svs_WithCompression(string endp IDatabase db = GetCleanDatabase(endpointId); // ReSharper disable once RedundantArgumentDefaultValue var ft = db.FT(2); - var schema = new Schema().AddSvsVanamaVectorField("v", Schema.VectorField.VectorType.FLOAT16, 5, + var schema = new Schema().AddSvsVamanaVectorField("v", Schema.VectorField.VectorType.FLOAT16, 5, Schema.VectorField.VectorDistanceMetric.EuclideanDistance, reducedDimensions: 2, compressionAlgorithm: Schema.VectorField.VectorCompressionAlgorithm.LeanVec4x8) - .AddSvsVanamaVectorField("v2", Schema.VectorField.VectorType.FLOAT32, 4, + .AddSvsVamanaVectorField("v2", Schema.VectorField.VectorType.FLOAT32, 4, Schema.VectorField.VectorDistanceMetric.EuclideanDistance, compressionAlgorithm: Schema.VectorField.VectorCompressionAlgorithm.LVQ4); @@ -387,7 +387,7 @@ public void TestIndexingCreation_Default() Schema.VectorField.VectorDistanceMetric.EuclideanDistance, missingIndex: true) .AddHnswVectorField("vector2", Schema.VectorField.VectorType.FLOAT64, 3, Schema.VectorField.VectorDistanceMetric.CosineDistance, missingIndex: false) - .AddSvsVanamaVectorField("vector3", Schema.VectorField.VectorType.FLOAT16, 4, + .AddSvsVamanaVectorField("vector3", Schema.VectorField.VectorType.FLOAT16, 4, Schema.VectorField.VectorDistanceMetric.InnerProduct, missingIndex: true); var ftCreateParams = FTCreateParams.CreateParams(); @@ -430,7 +430,7 @@ public void TestIndexingCreation_Custom_Everything() Schema.VectorField.VectorDistanceMetric.CosineDistance, maxOutgoingConnections: 10, maxConnectedNeighbors: 20, maxTopCandidates: 30, boundaryFactor: 0.7, missingIndex: false) - .AddSvsVanamaVectorField("vector3", Schema.VectorField.VectorType.FLOAT16, 4, + .AddSvsVamanaVectorField("vector3", Schema.VectorField.VectorType.FLOAT16, 4, Schema.VectorField.VectorDistanceMetric.InnerProduct, compressionAlgorithm: Schema.VectorField.VectorCompressionAlgorithm.LeanVec4x8, constructionWindowSize: 35, graphMaxDegree: 17, searchWindowSize: 30,