Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NRedisStack/Search/Schema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ internal override void AddFieldTypeArgs(List<object> args)
args.Add(Algorithm.ToString());
if (Attributes != null)
{
args.Add(Attributes.Count());
args.Add(Attributes.Count() * 2);

foreach (var attribute in Attributes)
{
Expand Down
36 changes: 35 additions & 1 deletion tests/NRedisStack.Tests/Search/SearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ public void TestFieldsCommandBuilder()
"vec",
"VECTOR",
"FLAT",
"1",
"2",
"dim",
"10"
};
Expand Down Expand Up @@ -1876,6 +1876,40 @@ public async Task Test_ListAsync()
Assert.Equal(await ft._ListAsync(), new RedisResult[] { });
}

[Fact]
public async Task TestVectorCount_Issue70()
{
var schema = new Schema().AddVectorField("fieldTest", Schema.VectorField.VectorAlgo.HNSW, new Dictionary<string, object>()
{
["TYPE"] = "FLOAT32",
["DIM"] = "128",
["DISTANCE_METRIC"] = "COSINE"
});

var actual = SearchCommandBuilder.Create("test", new FTCreateParams(), schema);
var expected = new List<object>()
{
"test",
"SCHEMA",
"fieldTest",
"VECTOR",
"HNSW",
"6",
"TYPE",
"FLOAT32",
"DIM",
"128",
"DISTANCE_METRIC",
"COSINE"
};
Assert.Equal("FT.CREATE", actual.Command);
for (int i = 0; i < actual.Args.Length; i++)
{
Assert.Equal(expected[i].ToString(), actual.Args[i].ToString());
}
Assert.Equal(expected.Count(), actual.Args.Length);
}

[Fact]
public void TestModulePrefixs1()
{
Expand Down