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
4 changes: 2 additions & 2 deletions dotnet/src/VectorData/SqlServer/SqlServerCommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ private static string Map(PropertyModel property)
DistanceFunction.CosineDistance => ("COSINE", "ASC"),
// A value of 0 indicates that the vectors are identical, while larger values indicate greater dissimilarity.
DistanceFunction.EuclideanDistance => ("EUCLIDEAN", "ASC"),
// A value closer to 0 indicates higher similarity, while more negative values indicate greater dissimilarity.
DistanceFunction.NegativeDotProductSimilarity => ("DOT", "DESC"),
// Smaller numbers indicate more similar vectors
DistanceFunction.NegativeDotProductSimilarity => ("DOT", "ASC"),
_ => throw new NotSupportedException($"Distance function {name} is not supported.")
};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

using Microsoft.Extensions.Configuration;
using Microsoft.SemanticKernel.Connectors.SqlServer;

namespace SqlServer.ConformanceTests.Support;

Expand All @@ -17,7 +16,7 @@ internal static class SqlServerTestEnvironment
.AddJsonFile(path: "testsettings.json", optional: true)
.AddJsonFile(path: "testsettings.development.json", optional: true)
.AddEnvironmentVariables()
.AddUserSecrets<SqlServerVectorStore>()
.AddUserSecrets<SqlServerFixture>()
.Build();

return configuration.GetSection("SqlServer")["ConnectionString"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public virtual Task DotProductSimilarity()

[ConditionalFact]
public virtual Task NegativeDotProductSimilarity()
=> this.SimpleSearch(DistanceFunction.NegativeDotProductSimilarity, -1, 1, 0, [1, 2, 0]);
=> this.SimpleSearch(DistanceFunction.NegativeDotProductSimilarity, -1, 1, 0, [0, 2, 1]);

[ConditionalFact]
public virtual Task EuclideanDistance()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.

using Microsoft.Extensions.VectorData;
using VectorData.ConformanceTests.VectorSearch;
using Weaviate.ConformanceTests.Support;
using Xunit;
Expand All @@ -15,13 +14,6 @@ public class WeaviateVectorSearchDistanceFunctionComplianceTests_NamedVectors(We
public override Task DotProductSimilarity() => Assert.ThrowsAsync<NotSupportedException>(base.DotProductSimilarity);

public override Task EuclideanDistance() => Assert.ThrowsAsync<NotSupportedException>(base.EuclideanDistance);

/// <summary>
/// Tests vector search using <see cref="DistanceFunction.NegativeDotProductSimilarity"/>, computing -(u · v) as a distance metric per Weaviate's convention.
/// Expects scores of -1 (exact match), 1 (opposite), and 0 (orthogonal), sorted ascending ([0, 2, 1]), with lower scores indicating closer matches.
/// <see href="https://weaviate.io/developers/weaviate/config-refs/distances#available-distance-metrics"/>.
/// </summary>
public override Task NegativeDotProductSimilarity() => this.SimpleSearch(DistanceFunction.NegativeDotProductSimilarity, -1, 1, 0, [0, 2, 1]);
}

public class WeaviateVectorSearchDistanceFunctionComplianceTests_UnnamedVector(WeaviateDynamicDataModelNamedVectorsFixture fixture)
Expand All @@ -32,11 +24,4 @@ public class WeaviateVectorSearchDistanceFunctionComplianceTests_UnnamedVector(W
public override Task DotProductSimilarity() => Assert.ThrowsAsync<NotSupportedException>(base.DotProductSimilarity);

public override Task EuclideanDistance() => Assert.ThrowsAsync<NotSupportedException>(base.EuclideanDistance);

/// <summary>
/// Tests vector search using <see cref="DistanceFunction.NegativeDotProductSimilarity"/>, computing -(u · v) as a distance metric per Weaviate's convention.
/// Expects scores of -1 (exact match), 1 (opposite), and 0 (orthogonal), sorted ascending ([0, 2, 1]), with lower scores indicating closer matches.
/// <see href="https://weaviate.io/developers/weaviate/config-refs/distances#available-distance-metrics"/>.
/// </summary>
public override Task NegativeDotProductSimilarity() => this.SimpleSearch(DistanceFunction.NegativeDotProductSimilarity, -1, 1, 0, [0, 2, 1]);
}
Loading