Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Azure.Cosmos;
Expand All @@ -17,6 +17,7 @@ public HybridSearchCosmosTest(HybridSearchFixture fixture, ITestOutputHelper tes
protected HybridSearchFixture Fixture { get; }

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task Rrf_with_FullTextScore_and_VectorDistance()
Comment thread
roji marked this conversation as resolved.
{
await using var context = CreateContext();
Expand All @@ -40,6 +41,7 @@ ORDER BY RANK RRF(FullTextScore(c["Description"], "beaver", "otter"), VectorDist
}

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task Rrf_with_FullTextScore_and_VectorDistance_with_weights()
Comment thread
roji marked this conversation as resolved.
{
await using var context = CreateContext();
Expand Down Expand Up @@ -129,20 +131,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
b.Property(x => x.Description).EnableFullTextSearch();
b.HasIndex(x => x.Description).IsFullTextIndex();

b.HasIndex(e => e.Bytes).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.SBytes).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.BytesArray).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.SinglesArray).IsVectorIndex(VectorIndexType.Flat);

b.Property(e => e.Bytes).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SBytes).IsVectorProperty(DistanceFunction.DotProduct, 10);
b.Property(e => e.BytesArray).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SinglesArray).IsVectorProperty(DistanceFunction.Cosine, 10);

if (!TestEnvironment.IsLinuxEmulator)
{
b.HasIndex(e => e.SinglesArray).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.Bytes).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.SBytes).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.BytesArray).IsVectorIndex(VectorIndexType.DiskANN);
Comment thread
roji marked this conversation as resolved.
Outdated

b.Property(e => e.Bytes).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SBytes).IsVectorProperty(DistanceFunction.DotProduct, 10);
b.Property(e => e.BytesArray).IsVectorProperty(DistanceFunction.Cosine, 10);
}

b.OwnsOne(
x => x.Owned, bb =>
{
bb.HasIndex(e => e.Singles).IsVectorIndex(VectorIndexType.Flat);
if (!TestEnvironment.IsLinuxEmulator)
{
bb.HasIndex(e => e.Singles).IsVectorIndex(VectorIndexType.DiskANN);
}
Comment thread
roji marked this conversation as resolved.
Outdated

bb.Property(e => e.Singles).IsVectorProperty(DistanceFunction.Cosine, 10);

bb.Property(x => x.AnotherDescription).EnableFullTextSearch();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Azure.Cosmos;
Expand Down Expand Up @@ -67,6 +67,7 @@ FROM root c
}

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task OrderBy_VectorDistance_bytes_memory()
{
await using var context = CreateContext();
Expand All @@ -89,6 +90,7 @@ ORDER BY VectorDistance(c["Bytes"], @p)
}

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task OrderBy_VectorDistance_bytes_array()
{
await using var context = CreateContext();
Expand All @@ -111,6 +113,7 @@ ORDER BY VectorDistance(c["BytesArray"], @p)
}

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task OrderBy_VectorDistance_sbyte()
{
await using var context = CreateContext();
Expand Down Expand Up @@ -255,6 +258,7 @@ FROM root c
}

[ConditionalFact]
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public virtual async Task RRF_with_two_Vector_distance_functions_in_OrderBy()
{
await using var context = CreateContext();
Expand Down Expand Up @@ -392,23 +396,31 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
b.HasKey(e => e.Id);
b.HasPartitionKey(e => e.Publisher);

b.HasIndex(e => e.Bytes).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.SBytes).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.BytesArray).IsVectorIndex(VectorIndexType.Flat);
b.HasIndex(e => e.SinglesArray).IsVectorIndex(VectorIndexType.Flat);

b.Property(e => e.Bytes).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SBytes).IsVectorProperty(DistanceFunction.DotProduct, 10);
b.Property(e => e.BytesArray).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SinglesArray).IsVectorProperty(DistanceFunction.Cosine, 10);

if (!TestEnvironment.IsLinuxEmulator)
{
b.HasIndex(e => e.SinglesArray).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.Bytes).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.SBytes).IsVectorIndex(VectorIndexType.DiskANN);
b.HasIndex(e => e.BytesArray).IsVectorIndex(VectorIndexType.DiskANN);

b.Property(e => e.Bytes).IsVectorProperty(DistanceFunction.Cosine, 10);
b.Property(e => e.SBytes).IsVectorProperty(DistanceFunction.DotProduct, 10);
b.Property(e => e.BytesArray).IsVectorProperty(DistanceFunction.Cosine, 10);
}

b.OwnsOne(
x => x.OwnedReference, bb =>
{
bb.OwnsOne(
x => x.NestedOwned, bbb =>
{
bbb.HasIndex(x => x.NestedSingles).IsVectorIndex(VectorIndexType.Flat);
if (!TestEnvironment.IsLinuxEmulator)
{
bbb.HasIndex(x => x.NestedSingles).IsVectorIndex(VectorIndexType.DiskANN);
}

bbb.Property(x => x.NestedSingles).IsVectorProperty(DistanceFunction.Cosine, 10);
});

Expand Down
Loading