Initialize CBDD solution and add a .NET-focused gitignore for generated artifacts.

This commit is contained in:
Joseph Doherty
2026-02-20 12:54:07 -05:00
commit b8ed5ec500
214 changed files with 101452 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using ZB.MOM.WW.CBDD.Bson;
using ZB.MOM.WW.CBDD.Core;
using ZB.MOM.WW.CBDD.Core.Indexing;
using ZB.MOM.WW.CBDD.Shared;
using Xunit;
namespace ZB.MOM.WW.CBDD.Tests;
public class VectorSearchTests
{
[Fact]
public void Test_VectorSearch_Basic()
{
string dbPath = "vector_test.db";
if (File.Exists(dbPath)) File.Delete(dbPath);
using (var db = new Shared.TestDbContext(dbPath))
{
db.VectorItems.Insert(new VectorEntity { Title = "Near", Embedding = [1.0f, 1.0f, 1.0f] });
db.VectorItems.Insert(new VectorEntity { Title = "Far", Embedding = [10.0f, 10.0f, 10.0f] });
var query = new[] { 0.9f, 0.9f, 0.9f };
var results = db.VectorItems.AsQueryable().Where(x => x.Embedding.VectorSearch(query, 1)).ToList();
results.Count().ShouldBe(1);
results[0].Title.ShouldBe("Near");
}
File.Delete(dbPath);
}
}